mol_time_all 1.1.9 → 1.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/web.esm.js CHANGED
@@ -1,33 +1,39 @@
1
+ "use strict";
2
+ function require( path ){ return $node[ path ] };
1
3
  "use strict"
2
- /// Fake namespace for optional overrides
3
- ///
4
- /// namespace $ { export var x = 1 , y = 1 } // defaults
5
- /// namespace $.$$ { export var x = 2 } // overrides
6
- /// namespace $.$$ { console.log( x , y ) } // usage
7
- ///
8
- var $ = $ || ( typeof module === 'object' ) && module['export'+'s'] || ( typeof window === 'object' ) && window
9
- $.$$ = $
10
4
 
11
- $.$mol = $ // deprecated
5
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
6
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
8
+ else for (var i = decorators.length - 1; i >= 0; i--) if ((d = decorators[i])) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
9
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
10
+ };
11
+
12
+ var globalThis = globalThis || ( typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : this )
13
+ var $ = ( typeof module === 'object' ) ? Object.setPrototypeOf( module['export'+'s'] , globalThis ) : globalThis
14
+ $.$$ = $
12
15
 
13
16
  ;
14
17
 
15
18
  var $node = $node || {}
16
- void function( module ) { var exports = module.exports = this; function require( id ) { return $node[ id.replace( /^.\// , "../mol/" ) + ".js" ] };
17
-
19
+ void function( module ) { var exports = module.exports = this; function require( id ) { return $node[ id.replace( /^.\// , "../" ) ] };
18
20
  ;
19
21
  "use strict";
20
- Object.defineProperty(exports, "__esModule", { value: true });
21
- //mol.js.map
22
+ Error.stackTraceLimit = 50;
23
+ var $;
24
+ (function ($) {
25
+ })($ || ($ = {}));
26
+ module.exports = $;
27
+ //mam.js.map
22
28
  ;
23
29
 
24
- $node[ "../mol/mol.js" ] = $node[ "../mol/mol.js" ] = module.exports }.call( {} , {} )
25
-
30
+ $node[ "../mam" ] = $node[ "../mam.js" ] = module.exports }.call( {} , {} )
26
31
  ;
27
32
  "use strict";
28
33
  var $;
29
34
  (function ($) {
30
35
  class $mol_time_base {
36
+ static patterns = {};
31
37
  static formatter(pattern) {
32
38
  if (this.patterns[pattern])
33
39
  return this.patterns[pattern];
@@ -49,12 +55,11 @@ var $;
49
55
  };
50
56
  }
51
57
  toString(pattern) {
52
- var Base = this.constructor;
53
- var formatter = Base.formatter(pattern);
54
- return formatter.call(Base, this);
58
+ const Base = this.constructor;
59
+ const formatter = Base.formatter(pattern);
60
+ return formatter(this);
55
61
  }
56
62
  }
57
- $mol_time_base.patterns = {};
58
63
  $.$mol_time_base = $mol_time_base;
59
64
  })($ || ($ = {}));
60
65
  //base.js.map
@@ -65,12 +70,6 @@ var $;
65
70
  class $mol_time_duration extends $.$mol_time_base {
66
71
  constructor(config = 0) {
67
72
  super();
68
- this.year = 0;
69
- this.month = 0;
70
- this.day = 0;
71
- this.hour = 0;
72
- this.minute = 0;
73
- this.second = 0;
74
73
  if (typeof config === 'number') {
75
74
  this.second = config / 1000;
76
75
  return;
@@ -120,6 +119,12 @@ var $;
120
119
  this.minute = config.minute || 0;
121
120
  this.second = config.second || 0;
122
121
  }
122
+ year = 0;
123
+ month = 0;
124
+ day = 0;
125
+ hour = 0;
126
+ minute = 0;
127
+ second = 0;
123
128
  summ(config) {
124
129
  const duration = new $mol_time_duration(config);
125
130
  return new $mol_time_duration({
@@ -154,55 +159,39 @@ var $;
154
159
  toString(pattern = 'P#Y#M#DT#h#m#s') {
155
160
  return super.toString(pattern);
156
161
  }
162
+ static patterns = {
163
+ '#Y': (duration) => {
164
+ if (!duration.year)
165
+ return '';
166
+ return duration.year + 'Y';
167
+ },
168
+ '#M': (duration) => {
169
+ if (!duration.month)
170
+ return '';
171
+ return duration.month + 'M';
172
+ },
173
+ '#D': (duration) => {
174
+ if (!duration.day)
175
+ return '';
176
+ return duration.day + 'D';
177
+ },
178
+ '#h': (duration) => {
179
+ if (!duration.hour)
180
+ return '';
181
+ return duration.hour + 'H';
182
+ },
183
+ '#m': (duration) => {
184
+ if (!duration.minute)
185
+ return '';
186
+ return duration.minute + 'M';
187
+ },
188
+ '#s': (duration) => {
189
+ if (!duration.second)
190
+ return '';
191
+ return duration.second + 'S';
192
+ },
193
+ };
157
194
  }
158
- $mol_time_duration.patterns = {
159
- '#Y': (duration) => {
160
- if (!duration.year)
161
- return '';
162
- return duration.year + 'Y';
163
- },
164
- '#M': (duration) => {
165
- if (!duration.month)
166
- return '';
167
- return duration.month + 'M';
168
- },
169
- '#D': (duration) => {
170
- if (!duration.day)
171
- return '';
172
- return duration.day + 'D';
173
- },
174
- '#h': (duration) => {
175
- if (!duration.hour)
176
- return '';
177
- return duration.hour + 'H';
178
- },
179
- '#m': (duration) => {
180
- if (!duration.minute)
181
- return '';
182
- return duration.minute + 'M';
183
- },
184
- '#s': (duration) => {
185
- if (!duration.second)
186
- return '';
187
- return duration.second + 'S';
188
- },
189
- '+hh': (duration) => {
190
- var hour = duration.hour;
191
- var sign = '+';
192
- if (hour < 0) {
193
- sign = '-';
194
- hour = -hour;
195
- }
196
- return (hour < 10)
197
- ? (sign + '0' + hour)
198
- : (sign + hour);
199
- },
200
- 'mm': (duration) => {
201
- return (duration.minute < 10)
202
- ? ('0' + duration.minute)
203
- : String(duration.minute);
204
- },
205
- };
206
195
  $.$mol_time_duration = $mol_time_duration;
207
196
  })($ || ($ = {}));
208
197
  //duration.js.map
@@ -210,27 +199,53 @@ var $;
210
199
  "use strict";
211
200
  var $;
212
201
  (function ($) {
202
+ function $mol_fail(error) {
203
+ throw error;
204
+ }
205
+ $.$mol_fail = $mol_fail;
206
+ })($ || ($ = {}));
207
+ //fail.js.map
208
+ ;
209
+ "use strict";
210
+ var $;
211
+ (function ($) {
212
+ let $mol_time_moment_weekdays;
213
+ (function ($mol_time_moment_weekdays) {
214
+ $mol_time_moment_weekdays[$mol_time_moment_weekdays["monday"] = 0] = "monday";
215
+ $mol_time_moment_weekdays[$mol_time_moment_weekdays["tuesday"] = 1] = "tuesday";
216
+ $mol_time_moment_weekdays[$mol_time_moment_weekdays["wednesday"] = 2] = "wednesday";
217
+ $mol_time_moment_weekdays[$mol_time_moment_weekdays["thursday"] = 3] = "thursday";
218
+ $mol_time_moment_weekdays[$mol_time_moment_weekdays["friday"] = 4] = "friday";
219
+ $mol_time_moment_weekdays[$mol_time_moment_weekdays["saturday"] = 5] = "saturday";
220
+ $mol_time_moment_weekdays[$mol_time_moment_weekdays["sunday"] = 6] = "sunday";
221
+ })($mol_time_moment_weekdays = $.$mol_time_moment_weekdays || ($.$mol_time_moment_weekdays = {}));
222
+ function numb(str, max) {
223
+ const numb = Number(str);
224
+ if (numb < max)
225
+ return numb;
226
+ $.$mol_fail(new Error(`Wrong time component ${str}`));
227
+ }
213
228
  class $mol_time_moment extends $.$mol_time_base {
214
229
  constructor(config = new Date) {
215
230
  super();
216
231
  if (typeof config === 'number')
217
232
  config = new Date(config);
218
233
  if (typeof config === 'string') {
219
- var parsed = /^(?:(\d\d\d\d)(?:-?(\d\d)(?:-?(\d\d))?)?)?(?:[T ](\d\d)(?::?(\d\d)(?::?(\d\d(?:\.\d\d\d)?))?)?(Z|[\+\-]\d\d(?::?(?:\d\d)?)?)?)?$/.exec(config);
234
+ const parsed = /^(?:(\d\d?\d?\d?)(?:-?(\d\d?)(?:-?(\d\d?))?)?)?(?:[T ](?:(\d\d?)(?::?(\d\d?)(?::?(\d\d?(?:\.\d+)?))?)?)?(Z|[\+\-]\d\d?(?::?(?:\d\d?)?)?)?)?$/.exec(config);
220
235
  if (!parsed)
221
236
  throw new Error(`Can not parse time moment (${config})`);
222
237
  if (parsed[1])
223
- this.year = Number(parsed[1]);
238
+ this.year = numb(parsed[1], 9999);
224
239
  if (parsed[2])
225
- this.month = Number(parsed[2]) - 1;
240
+ this.month = numb(parsed[2], 13) - 1;
226
241
  if (parsed[3])
227
- this.day = Number(parsed[3]) - 1;
242
+ this.day = numb(parsed[3], 32) - 1;
228
243
  if (parsed[4])
229
- this.hour = Number(parsed[4]);
244
+ this.hour = numb(parsed[4], 60);
230
245
  if (parsed[5])
231
- this.minute = Number(parsed[5]);
246
+ this.minute = numb(parsed[5], 60);
232
247
  if (parsed[6])
233
- this.second = Number(parsed[6]);
248
+ this.second = numb(parsed[6], 60);
234
249
  if (parsed[7])
235
250
  this.offset = new $.$mol_time_duration(parsed[7]);
236
251
  return;
@@ -242,7 +257,7 @@ var $;
242
257
  this.hour = config.getHours();
243
258
  this.minute = config.getMinutes();
244
259
  this.second = config.getSeconds() + config.getMilliseconds() / 1000;
245
- var offset = -config.getTimezoneOffset();
260
+ const offset = -config.getTimezoneOffset();
246
261
  this.offset = new $.$mol_time_duration({
247
262
  hour: (offset < 0) ? Math.ceil(offset / 60) : Math.floor(offset / 60),
248
263
  minute: offset % 60
@@ -255,65 +270,94 @@ var $;
255
270
  this.hour = config.hour;
256
271
  this.minute = config.minute;
257
272
  this.second = config.second;
258
- if (config.offset !== undefined)
259
- this.offset = new $.$mol_time_duration(config.offset);
273
+ this.offset = config.offset == null ? config.offset : new $.$mol_time_duration(config.offset);
260
274
  }
275
+ year;
276
+ month;
277
+ day;
278
+ hour;
279
+ minute;
280
+ second;
281
+ offset;
261
282
  get weekday() {
262
283
  return (this.native.getDay() + 6) % 7;
263
284
  }
285
+ _native;
264
286
  get native() {
265
287
  if (this._native)
266
288
  return this._native;
267
- var utc = this.toOffset('Z');
268
- return this._native = new Date(Date.UTC((utc.year || 0), (utc.month || 0), (utc.day || 0) + 1, (utc.hour || 0), (utc.minute || 0), (utc.second && Math.floor(utc.second) || 0), (utc.second && Math.floor((utc.second - Math.floor(utc.second)) * 1000) || 0)));
289
+ const utc = this.toOffset('Z');
290
+ return this._native = new Date(Date.UTC(utc.year ?? 0, utc.month ?? 0, (utc.day ?? 0) + 1, utc.hour ?? 0, utc.minute ?? 0, utc.second != undefined ? Math.floor(utc.second) : 0, utc.second != undefined ? Math.floor((utc.second - Math.floor(utc.second)) * 1000) : 0));
269
291
  }
292
+ _normal;
270
293
  get normal() {
271
294
  if (this._normal)
272
295
  return this._normal;
273
296
  const moment = new $mol_time_moment(this.native);
274
297
  return this._normal = new $mol_time_moment({
275
- year: (this.year === undefined) ? undefined : moment.year,
276
- month: (this.month === undefined) ? undefined : moment.month,
277
- day: (this.day === undefined) ? undefined : moment.day,
278
- hour: (this.hour === undefined) ? undefined : moment.hour,
279
- minute: (this.minute === undefined) ? undefined : moment.minute,
280
- second: (this.second === undefined) ? undefined : moment.second,
281
- offset: (this.offset === undefined) ? undefined : moment.offset,
298
+ year: this.year === undefined ? undefined : moment.year,
299
+ month: this.month === undefined ? undefined : moment.month,
300
+ day: this.day === undefined ? undefined : moment.day,
301
+ hour: this.hour === undefined ? undefined : moment.hour,
302
+ minute: this.minute === undefined ? undefined : moment.minute,
303
+ second: this.second === undefined ? undefined : moment.second,
304
+ offset: this.offset === undefined ? undefined : moment.offset,
282
305
  });
283
306
  }
284
307
  merge(config) {
285
- var moment = new $mol_time_moment(config);
308
+ const moment = new $mol_time_moment(config);
286
309
  return new $mol_time_moment({
287
- year: (moment.year === undefined) ? this.year : moment.year,
288
- month: (moment.month === undefined) ? this.month : moment.month,
289
- day: (moment.day === undefined) ? this.day : moment.day,
290
- hour: (moment.hour === undefined) ? this.hour : moment.hour,
291
- minute: (moment.minute === undefined) ? this.minute : moment.minute,
292
- second: (moment.second === undefined) ? this.second : moment.second,
293
- offset: (moment.offset === undefined) ? this.offset : moment.offset,
310
+ year: moment.year === undefined ? this.year : moment.year,
311
+ month: moment.month === undefined ? this.month : moment.month,
312
+ day: moment.day === undefined ? this.day : moment.day,
313
+ hour: moment.hour === undefined ? this.hour : moment.hour,
314
+ minute: moment.minute === undefined ? this.minute : moment.minute,
315
+ second: moment.second === undefined ? this.second : moment.second,
316
+ offset: moment.offset === undefined ? this.offset : moment.offset,
294
317
  });
295
318
  }
296
319
  shift(config) {
297
- var duration = new $.$mol_time_duration(config);
298
- var moment = new $mol_time_moment().merge(this);
299
- var second = (moment.second + (duration.second || 0));
300
- var native = new Date(moment.year + (duration.year || 0), moment.month + (duration.month || 0), moment.day + 1 + (duration.day || 0), moment.hour + (duration.hour || 0), moment.minute + (duration.minute || 0), Math.floor(second), (second - Math.floor(second)) * 1000);
320
+ const duration = new $.$mol_time_duration(config);
321
+ const moment = new $mol_time_moment().merge({
322
+ year: this.year,
323
+ month: this.month,
324
+ day: this.day,
325
+ hour: this.hour ?? 0,
326
+ minute: this.minute ?? 0,
327
+ second: this.second ?? 0,
328
+ offset: this.offset ?? 0
329
+ });
330
+ const second = moment.second + (duration.second ?? 0);
331
+ const native = new Date(moment.year + (duration.year ?? 0), moment.month + (duration.month ?? 0), moment.day + 1 + (duration.day ?? 0), moment.hour + (duration.hour ?? 0), moment.minute + (duration.minute ?? 0), Math.floor(second), (second - Math.floor(second)) * 1000);
301
332
  if (isNaN(native.valueOf()))
302
333
  throw new Error('Wrong time');
303
334
  return new $mol_time_moment({
304
- year: (this.year === undefined) ? undefined : native.getFullYear(),
305
- month: (this.month === undefined) ? undefined : native.getMonth(),
306
- day: (this.day === undefined) ? undefined : native.getDate() - 1,
307
- hour: (this.hour === undefined) ? undefined : native.getHours(),
308
- minute: (this.minute === undefined) ? undefined : native.getMinutes(),
309
- second: (this.second === undefined) ? undefined : native.getSeconds() + native.getMilliseconds() / 1000,
335
+ year: this.year === undefined ? undefined : native.getFullYear(),
336
+ month: this.month === undefined ? undefined : native.getMonth(),
337
+ day: this.day === undefined ? undefined : native.getDate() - 1,
338
+ hour: this.hour === undefined ? undefined : native.getHours(),
339
+ minute: this.minute === undefined ? undefined : native.getMinutes(),
340
+ second: this.second === undefined ? undefined : native.getSeconds() + native.getMilliseconds() / 1000,
310
341
  offset: this.offset,
311
342
  });
312
343
  }
344
+ mask(config) {
345
+ const mask = new $mol_time_moment(config);
346
+ return new $mol_time_moment({
347
+ year: mask.year === undefined ? undefined : this.year,
348
+ month: mask.month === undefined ? undefined : this.month,
349
+ day: mask.day === undefined ? undefined : this.day,
350
+ hour: mask.hour === undefined ? undefined : this.hour,
351
+ minute: mask.minute === undefined ? undefined : this.minute,
352
+ second: mask.second === undefined ? undefined : this.second,
353
+ offset: mask.offset === undefined ? undefined : this.offset,
354
+ });
355
+ }
313
356
  toOffset(config) {
314
357
  const duration = new $.$mol_time_duration(config);
315
358
  const offset = this.offset || new $mol_time_moment().offset;
316
- const moment = this.shift(duration.summ(offset.mult(-1)));
359
+ let with_time = new $mol_time_moment('T00:00:00').merge(this);
360
+ const moment = with_time.shift(duration.summ(offset.mult(-1)));
317
361
  return moment.merge({ offset: duration });
318
362
  }
319
363
  valueOf() { return this.native.getTime(); }
@@ -321,167 +365,224 @@ var $;
321
365
  toString(pattern = 'YYYY-MM-DDThh:mm:ss.sssZ') {
322
366
  return super.toString(pattern);
323
367
  }
368
+ static patterns = {
369
+ 'YYYY': (moment) => {
370
+ if (moment.year == null)
371
+ return '';
372
+ return String(moment.year);
373
+ },
374
+ 'AD': (moment) => {
375
+ if (moment.year == null)
376
+ return '';
377
+ return String(Math.floor(moment.year / 100) + 1);
378
+ },
379
+ 'YY': (moment) => {
380
+ if (moment.year == null)
381
+ return '';
382
+ return String(moment.year % 100);
383
+ },
384
+ 'Month': (pattern => (moment) => {
385
+ if (moment.month == null)
386
+ return '';
387
+ return pattern.format(moment.native);
388
+ })(new Intl.DateTimeFormat(undefined, { month: 'long' })),
389
+ 'DD Month': (pattern => (moment) => {
390
+ if (moment.month == null) {
391
+ if (moment.day == null) {
392
+ return '';
393
+ }
394
+ else {
395
+ return $mol_time_moment.patterns['DD'](moment);
396
+ }
397
+ }
398
+ else {
399
+ if (moment.day == null) {
400
+ return $mol_time_moment.patterns['Month'](moment);
401
+ }
402
+ else {
403
+ return pattern.format(moment.native);
404
+ }
405
+ }
406
+ })(new Intl.DateTimeFormat(undefined, { day: '2-digit', month: 'long' })),
407
+ 'D Month': (pattern => (moment) => {
408
+ if (moment.month == null) {
409
+ if (moment.day == null) {
410
+ return '';
411
+ }
412
+ else {
413
+ return $mol_time_moment.patterns['D'](moment);
414
+ }
415
+ }
416
+ else {
417
+ if (moment.day == null) {
418
+ return $mol_time_moment.patterns['Month'](moment);
419
+ }
420
+ else {
421
+ return pattern.format(moment.native);
422
+ }
423
+ }
424
+ })(new Intl.DateTimeFormat(undefined, { day: 'numeric', month: 'long' })),
425
+ 'Mon': (pattern => (moment) => {
426
+ if (moment.month == null)
427
+ return '';
428
+ return pattern.format(moment.native);
429
+ })(new Intl.DateTimeFormat(undefined, { month: 'short' })),
430
+ 'DD Mon': (pattern => (moment) => {
431
+ if (moment.month == null) {
432
+ if (moment.day == null) {
433
+ return '';
434
+ }
435
+ else {
436
+ return $mol_time_moment.patterns['DD'](moment);
437
+ }
438
+ }
439
+ else {
440
+ if (moment.day == null) {
441
+ return $mol_time_moment.patterns['Mon'](moment);
442
+ }
443
+ else {
444
+ return pattern.format(moment.native);
445
+ }
446
+ }
447
+ })(new Intl.DateTimeFormat(undefined, { day: '2-digit', month: 'short' })),
448
+ 'D Mon': (pattern => (moment) => {
449
+ if (moment.month == null) {
450
+ if (moment.day == null) {
451
+ return '';
452
+ }
453
+ else {
454
+ return $mol_time_moment.patterns['D'](moment);
455
+ }
456
+ }
457
+ else {
458
+ if (moment.day == null) {
459
+ return $mol_time_moment.patterns['Mon'](moment);
460
+ }
461
+ else {
462
+ return pattern.format(moment.native);
463
+ }
464
+ }
465
+ })(new Intl.DateTimeFormat(undefined, { day: 'numeric', month: 'short' })),
466
+ '-MM': (moment) => {
467
+ if (moment.month == null)
468
+ return '';
469
+ return '-' + $mol_time_moment.patterns['MM'](moment);
470
+ },
471
+ 'MM': (moment) => {
472
+ if (moment.month == null)
473
+ return '';
474
+ return String(100 + moment.month + 1).slice(1);
475
+ },
476
+ 'M': (moment) => {
477
+ if (moment.month == null)
478
+ return '';
479
+ return String(moment.month + 1);
480
+ },
481
+ 'WeekDay': (pattern => (moment) => {
482
+ if (moment.day == null)
483
+ return '';
484
+ if (moment.month == null)
485
+ return '';
486
+ if (moment.year == null)
487
+ return '';
488
+ return pattern.format(moment.native);
489
+ })(new Intl.DateTimeFormat(undefined, { weekday: 'long' })),
490
+ 'WD': (pattern => (moment) => {
491
+ if (moment.day == null)
492
+ return '';
493
+ if (moment.month == null)
494
+ return '';
495
+ if (moment.year == null)
496
+ return '';
497
+ return pattern.format(moment.native);
498
+ })(new Intl.DateTimeFormat(undefined, { weekday: 'short' })),
499
+ '-DD': (moment) => {
500
+ if (moment.day == null)
501
+ return '';
502
+ return '-' + $mol_time_moment.patterns['DD'](moment);
503
+ },
504
+ 'DD': (moment) => {
505
+ if (moment.day == null)
506
+ return '';
507
+ return String(100 + moment.day + 1).slice(1);
508
+ },
509
+ 'D': (moment) => {
510
+ if (moment.day == null)
511
+ return '';
512
+ return String(moment.day + 1);
513
+ },
514
+ 'Thh': (moment) => {
515
+ if (moment.hour == null)
516
+ return '';
517
+ return 'T' + $mol_time_moment.patterns['hh'](moment);
518
+ },
519
+ 'hh': (moment) => {
520
+ if (moment.hour == null)
521
+ return '';
522
+ return String(100 + moment.hour).slice(1);
523
+ },
524
+ 'h': (moment) => {
525
+ if (moment.hour == null)
526
+ return '';
527
+ return String(moment.hour);
528
+ },
529
+ ':mm': (moment) => {
530
+ if (moment.minute == null)
531
+ return '';
532
+ return ':' + $mol_time_moment.patterns['mm'](moment);
533
+ },
534
+ 'mm': (moment) => {
535
+ if (moment.minute == null)
536
+ return '';
537
+ return String(100 + moment.minute).slice(1);
538
+ },
539
+ 'm': (moment) => {
540
+ if (moment.minute == null)
541
+ return '';
542
+ return String(moment.minute);
543
+ },
544
+ ':ss': (moment) => {
545
+ if (moment.second == null)
546
+ return '';
547
+ return ':' + $mol_time_moment.patterns['ss'](moment);
548
+ },
549
+ 'ss': (moment) => {
550
+ if (moment.second == null)
551
+ return '';
552
+ return String(100 + moment.second | 0).slice(1);
553
+ },
554
+ 's': (moment) => {
555
+ if (moment.second == null)
556
+ return '';
557
+ return String(moment.second | 0);
558
+ },
559
+ '.sss': (moment) => {
560
+ if (moment.second == null)
561
+ return '';
562
+ if (moment.second === (moment.second | 0))
563
+ return '';
564
+ return '.' + $mol_time_moment.patterns['sss'](moment);
565
+ },
566
+ 'sss': (moment) => {
567
+ if (moment.second == null)
568
+ return '';
569
+ const millisecond = Math.floor((moment.second - Math.floor(moment.second)) * 1000);
570
+ return String(1000 + millisecond).slice(1);
571
+ },
572
+ 'Z': (moment) => {
573
+ const offset = moment.offset;
574
+ if (!offset)
575
+ return '';
576
+ let hour = offset.hour;
577
+ let sign = '+';
578
+ if (hour < 0) {
579
+ sign = '-';
580
+ hour = -hour;
581
+ }
582
+ return sign + String(100 + hour).slice(1) + ':' + String(100 + offset.minute).slice(1);
583
+ }
584
+ };
324
585
  }
325
- $mol_time_moment.patterns = {
326
- 'YYYY': (moment) => {
327
- if (moment.year == null)
328
- return '';
329
- return String(moment.year);
330
- },
331
- 'AD': (moment) => {
332
- if (moment.year == null)
333
- return '';
334
- return String(Math.floor(moment.year / 100) + 1);
335
- },
336
- 'YY': (moment) => {
337
- if (moment.year == null)
338
- return '';
339
- return String(moment.year % 100);
340
- },
341
- 'Month': (moment) => {
342
- if (moment.month == null)
343
- return '';
344
- return moment.native.toLocaleString(undefined, { month: 'long' });
345
- },
346
- 'DD Month': (moment) => {
347
- return moment.native.toLocaleString(undefined, { day: '2-digit', month: 'long' });
348
- },
349
- 'D Month': (moment) => {
350
- return moment.native.toLocaleString(undefined, { day: 'numeric', month: 'long' });
351
- },
352
- 'Mon': (moment) => {
353
- if (moment.month == null)
354
- return '';
355
- return moment.native.toLocaleString(undefined, { month: 'short' });
356
- },
357
- 'DD Mon': (moment) => {
358
- return moment.native.toLocaleString(undefined, { day: '2-digit', month: 'short' });
359
- },
360
- 'D Mon': (moment) => {
361
- return moment.native.toLocaleString(undefined, { day: 'numeric', month: 'short' });
362
- },
363
- '-MM': (moment) => {
364
- if (moment.month == null)
365
- return '';
366
- return '-' + $mol_time_moment.patterns['MM'](moment);
367
- },
368
- 'MM': (moment) => {
369
- if (moment.month == null)
370
- return '';
371
- var month = moment.month + 1;
372
- return (month < 10)
373
- ? ('0' + month)
374
- : ('' + month);
375
- },
376
- 'M': (moment) => {
377
- if (moment.month == null)
378
- return '';
379
- return String(moment.month + 1);
380
- },
381
- 'WeekDay': (moment) => {
382
- if (moment.weekday == null)
383
- return '';
384
- return moment.native.toLocaleString(undefined, { weekday: 'long' });
385
- },
386
- 'WD': (moment) => {
387
- if (moment.weekday == null)
388
- return '';
389
- return moment.native.toLocaleString(undefined, { weekday: 'short' });
390
- },
391
- '-DD': (moment) => {
392
- if (moment.day == null)
393
- return '';
394
- return '-' + $mol_time_moment.patterns['DD'](moment);
395
- },
396
- 'DD': (moment) => {
397
- if (moment.day == null)
398
- return '';
399
- var day = moment.day + 1;
400
- return (day < 10)
401
- ? ('0' + day)
402
- : String(day);
403
- },
404
- 'D': (moment) => {
405
- if (moment.day == null)
406
- return '';
407
- return String(moment.day + 1);
408
- },
409
- 'Thh': (moment) => {
410
- if (moment.hour == null)
411
- return '';
412
- return 'T' + $mol_time_moment.patterns['hh'](moment);
413
- },
414
- 'hh': (moment) => {
415
- if (moment.hour == null)
416
- return '';
417
- return (moment.hour < 10)
418
- ? ('0' + moment.hour)
419
- : String(moment.hour);
420
- },
421
- 'h': (moment) => {
422
- if (moment.hour == null)
423
- return '';
424
- return String(moment.hour);
425
- },
426
- ':mm': (moment) => {
427
- if (moment.minute == null)
428
- return '';
429
- return ':' + $mol_time_moment.patterns['mm'](moment);
430
- },
431
- 'mm': (moment) => {
432
- if (moment.minute == null)
433
- return '';
434
- return (moment.minute < 10)
435
- ? ('0' + moment.minute)
436
- : String(moment.minute);
437
- },
438
- 'm': (moment) => {
439
- if (moment.minute == null)
440
- return '';
441
- return String(moment.minute);
442
- },
443
- ':ss': (moment) => {
444
- if (moment.second == null)
445
- return '';
446
- return ':' + $mol_time_moment.patterns['ss'](moment);
447
- },
448
- 'ss': (moment) => {
449
- if (moment.second == null)
450
- return '';
451
- var second = Math.floor(moment.second);
452
- return (second < 10)
453
- ? ('0' + second)
454
- : String(second);
455
- },
456
- 's': (moment) => {
457
- if (moment.second == null)
458
- return '';
459
- return String(Math.floor(moment.second));
460
- },
461
- '.sss': (moment) => {
462
- if (moment.second == null)
463
- return '';
464
- if (moment.second - Math.floor(moment.second) === 0)
465
- return '';
466
- return '.' + $mol_time_moment.patterns['sss'](moment);
467
- },
468
- 'sss': (moment) => {
469
- if (moment.second == null)
470
- return '';
471
- var millisecond = Math.floor((moment.second - Math.floor(moment.second)) * 1000);
472
- return (millisecond < 10)
473
- ? ('00' + millisecond)
474
- : (millisecond < 100)
475
- ? ('0' + millisecond)
476
- : String(millisecond);
477
- },
478
- 'Z': (moment) => {
479
- var offset = moment.offset;
480
- if (!offset)
481
- return '';
482
- return offset.toString('+hh:mm');
483
- }
484
- };
485
586
  $.$mol_time_moment = $mol_time_moment;
486
587
  })($ || ($ = {}));
487
588
  //moment.js.map
@@ -525,16 +626,19 @@ var $;
525
626
  if (config.duration !== undefined)
526
627
  this._duration = new $.$mol_time_duration(config.duration);
527
628
  }
629
+ _start;
528
630
  get start() {
529
631
  if (this._start)
530
632
  return this._start;
531
633
  return this._start = this._end.shift(this._duration.mult(-1));
532
634
  }
635
+ _end;
533
636
  get end() {
534
637
  if (this._end)
535
638
  return this._end;
536
639
  return this._end = this._start.shift(this._duration);
537
640
  }
641
+ _duration;
538
642
  get duration() {
539
643
  if (this._duration)
540
644
  return this._duration;
@@ -550,4 +654,4 @@ var $;
550
654
  //interval.js.map
551
655
  ;
552
656
  export default $
553
- //# sourceMappingURL=web.esm.js.map
657
+ //# sourceMappingURL=web.esm.js.map