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/node.esm.js CHANGED
@@ -1,36 +1,39 @@
1
- require( "source-map-support" ).install(); var exports = void 0;
2
-
3
- ;
1
+ "use strict";
2
+ var exports = void 0;
4
3
  "use strict"
5
- /// Fake namespace for optional overrides
6
- ///
7
- /// namespace $ { export var x = 1 , y = 1 } // defaults
8
- /// namespace $.$$ { export var x = 2 } // overrides
9
- /// namespace $.$$ { console.log( x , y ) } // usage
10
- ///
11
- var $ = $ || ( typeof module === 'object' ) && module['export'+'s'] || ( typeof window === 'object' ) && window
12
- $.$$ = $
13
4
 
14
- $.$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
+ $.$$ = $
15
15
 
16
16
  ;
17
17
 
18
18
  var $node = $node || {}
19
- void function( module ) { var exports = module.exports = this; function require( id ) { return $node[ id.replace( /^.\// , "../mol/" ) + ".js" ] };
20
-
19
+ void function( module ) { var exports = module.exports = this; function require( id ) { return $node[ id.replace( /^.\// , "../" ) ] };
21
20
  ;
22
21
  "use strict";
23
- Object.defineProperty(exports, "__esModule", { value: true });
24
- //mol.js.map
22
+ Error.stackTraceLimit = 50;
23
+ var $;
24
+ (function ($) {
25
+ })($ || ($ = {}));
26
+ module.exports = $;
27
+ //mam.js.map
25
28
  ;
26
29
 
27
- $node[ "../mol/mol.js" ] = $node[ "../mol/mol.js" ] = module.exports }.call( {} , {} )
28
-
30
+ $node[ "../mam" ] = $node[ "../mam.js" ] = module.exports }.call( {} , {} )
29
31
  ;
30
32
  "use strict";
31
33
  var $;
32
34
  (function ($) {
33
35
  class $mol_time_base {
36
+ static patterns = {};
34
37
  static formatter(pattern) {
35
38
  if (this.patterns[pattern])
36
39
  return this.patterns[pattern];
@@ -52,12 +55,11 @@ var $;
52
55
  };
53
56
  }
54
57
  toString(pattern) {
55
- var Base = this.constructor;
56
- var formatter = Base.formatter(pattern);
57
- return formatter.call(Base, this);
58
+ const Base = this.constructor;
59
+ const formatter = Base.formatter(pattern);
60
+ return formatter(this);
58
61
  }
59
62
  }
60
- $mol_time_base.patterns = {};
61
63
  $.$mol_time_base = $mol_time_base;
62
64
  })($ || ($ = {}));
63
65
  //base.js.map
@@ -68,12 +70,6 @@ var $;
68
70
  class $mol_time_duration extends $.$mol_time_base {
69
71
  constructor(config = 0) {
70
72
  super();
71
- this.year = 0;
72
- this.month = 0;
73
- this.day = 0;
74
- this.hour = 0;
75
- this.minute = 0;
76
- this.second = 0;
77
73
  if (typeof config === 'number') {
78
74
  this.second = config / 1000;
79
75
  return;
@@ -123,6 +119,12 @@ var $;
123
119
  this.minute = config.minute || 0;
124
120
  this.second = config.second || 0;
125
121
  }
122
+ year = 0;
123
+ month = 0;
124
+ day = 0;
125
+ hour = 0;
126
+ minute = 0;
127
+ second = 0;
126
128
  summ(config) {
127
129
  const duration = new $mol_time_duration(config);
128
130
  return new $mol_time_duration({
@@ -157,55 +159,39 @@ var $;
157
159
  toString(pattern = 'P#Y#M#DT#h#m#s') {
158
160
  return super.toString(pattern);
159
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
+ };
160
194
  }
161
- $mol_time_duration.patterns = {
162
- '#Y': (duration) => {
163
- if (!duration.year)
164
- return '';
165
- return duration.year + 'Y';
166
- },
167
- '#M': (duration) => {
168
- if (!duration.month)
169
- return '';
170
- return duration.month + 'M';
171
- },
172
- '#D': (duration) => {
173
- if (!duration.day)
174
- return '';
175
- return duration.day + 'D';
176
- },
177
- '#h': (duration) => {
178
- if (!duration.hour)
179
- return '';
180
- return duration.hour + 'H';
181
- },
182
- '#m': (duration) => {
183
- if (!duration.minute)
184
- return '';
185
- return duration.minute + 'M';
186
- },
187
- '#s': (duration) => {
188
- if (!duration.second)
189
- return '';
190
- return duration.second + 'S';
191
- },
192
- '+hh': (duration) => {
193
- var hour = duration.hour;
194
- var sign = '+';
195
- if (hour < 0) {
196
- sign = '-';
197
- hour = -hour;
198
- }
199
- return (hour < 10)
200
- ? (sign + '0' + hour)
201
- : (sign + hour);
202
- },
203
- 'mm': (duration) => {
204
- return (duration.minute < 10)
205
- ? ('0' + duration.minute)
206
- : String(duration.minute);
207
- },
208
- };
209
195
  $.$mol_time_duration = $mol_time_duration;
210
196
  })($ || ($ = {}));
211
197
  //duration.js.map
@@ -213,27 +199,53 @@ var $;
213
199
  "use strict";
214
200
  var $;
215
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
+ }
216
228
  class $mol_time_moment extends $.$mol_time_base {
217
229
  constructor(config = new Date) {
218
230
  super();
219
231
  if (typeof config === 'number')
220
232
  config = new Date(config);
221
233
  if (typeof config === 'string') {
222
- 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);
223
235
  if (!parsed)
224
236
  throw new Error(`Can not parse time moment (${config})`);
225
237
  if (parsed[1])
226
- this.year = Number(parsed[1]);
238
+ this.year = numb(parsed[1], 9999);
227
239
  if (parsed[2])
228
- this.month = Number(parsed[2]) - 1;
240
+ this.month = numb(parsed[2], 13) - 1;
229
241
  if (parsed[3])
230
- this.day = Number(parsed[3]) - 1;
242
+ this.day = numb(parsed[3], 32) - 1;
231
243
  if (parsed[4])
232
- this.hour = Number(parsed[4]);
244
+ this.hour = numb(parsed[4], 60);
233
245
  if (parsed[5])
234
- this.minute = Number(parsed[5]);
246
+ this.minute = numb(parsed[5], 60);
235
247
  if (parsed[6])
236
- this.second = Number(parsed[6]);
248
+ this.second = numb(parsed[6], 60);
237
249
  if (parsed[7])
238
250
  this.offset = new $.$mol_time_duration(parsed[7]);
239
251
  return;
@@ -245,7 +257,7 @@ var $;
245
257
  this.hour = config.getHours();
246
258
  this.minute = config.getMinutes();
247
259
  this.second = config.getSeconds() + config.getMilliseconds() / 1000;
248
- var offset = -config.getTimezoneOffset();
260
+ const offset = -config.getTimezoneOffset();
249
261
  this.offset = new $.$mol_time_duration({
250
262
  hour: (offset < 0) ? Math.ceil(offset / 60) : Math.floor(offset / 60),
251
263
  minute: offset % 60
@@ -258,65 +270,94 @@ var $;
258
270
  this.hour = config.hour;
259
271
  this.minute = config.minute;
260
272
  this.second = config.second;
261
- if (config.offset !== undefined)
262
- this.offset = new $.$mol_time_duration(config.offset);
273
+ this.offset = config.offset == null ? config.offset : new $.$mol_time_duration(config.offset);
263
274
  }
275
+ year;
276
+ month;
277
+ day;
278
+ hour;
279
+ minute;
280
+ second;
281
+ offset;
264
282
  get weekday() {
265
283
  return (this.native.getDay() + 6) % 7;
266
284
  }
285
+ _native;
267
286
  get native() {
268
287
  if (this._native)
269
288
  return this._native;
270
- var utc = this.toOffset('Z');
271
- 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));
272
291
  }
292
+ _normal;
273
293
  get normal() {
274
294
  if (this._normal)
275
295
  return this._normal;
276
296
  const moment = new $mol_time_moment(this.native);
277
297
  return this._normal = new $mol_time_moment({
278
- year: (this.year === undefined) ? undefined : moment.year,
279
- month: (this.month === undefined) ? undefined : moment.month,
280
- day: (this.day === undefined) ? undefined : moment.day,
281
- hour: (this.hour === undefined) ? undefined : moment.hour,
282
- minute: (this.minute === undefined) ? undefined : moment.minute,
283
- second: (this.second === undefined) ? undefined : moment.second,
284
- 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,
285
305
  });
286
306
  }
287
307
  merge(config) {
288
- var moment = new $mol_time_moment(config);
308
+ const moment = new $mol_time_moment(config);
289
309
  return new $mol_time_moment({
290
- year: (moment.year === undefined) ? this.year : moment.year,
291
- month: (moment.month === undefined) ? this.month : moment.month,
292
- day: (moment.day === undefined) ? this.day : moment.day,
293
- hour: (moment.hour === undefined) ? this.hour : moment.hour,
294
- minute: (moment.minute === undefined) ? this.minute : moment.minute,
295
- second: (moment.second === undefined) ? this.second : moment.second,
296
- 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,
297
317
  });
298
318
  }
299
319
  shift(config) {
300
- var duration = new $.$mol_time_duration(config);
301
- var moment = new $mol_time_moment().merge(this);
302
- var second = (moment.second + (duration.second || 0));
303
- 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);
304
332
  if (isNaN(native.valueOf()))
305
333
  throw new Error('Wrong time');
306
334
  return new $mol_time_moment({
307
- year: (this.year === undefined) ? undefined : native.getFullYear(),
308
- month: (this.month === undefined) ? undefined : native.getMonth(),
309
- day: (this.day === undefined) ? undefined : native.getDate() - 1,
310
- hour: (this.hour === undefined) ? undefined : native.getHours(),
311
- minute: (this.minute === undefined) ? undefined : native.getMinutes(),
312
- 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,
313
341
  offset: this.offset,
314
342
  });
315
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
+ }
316
356
  toOffset(config) {
317
357
  const duration = new $.$mol_time_duration(config);
318
358
  const offset = this.offset || new $mol_time_moment().offset;
319
- 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)));
320
361
  return moment.merge({ offset: duration });
321
362
  }
322
363
  valueOf() { return this.native.getTime(); }
@@ -324,167 +365,224 @@ var $;
324
365
  toString(pattern = 'YYYY-MM-DDThh:mm:ss.sssZ') {
325
366
  return super.toString(pattern);
326
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
+ };
327
585
  }
328
- $mol_time_moment.patterns = {
329
- 'YYYY': (moment) => {
330
- if (moment.year == null)
331
- return '';
332
- return String(moment.year);
333
- },
334
- 'AD': (moment) => {
335
- if (moment.year == null)
336
- return '';
337
- return String(Math.floor(moment.year / 100) + 1);
338
- },
339
- 'YY': (moment) => {
340
- if (moment.year == null)
341
- return '';
342
- return String(moment.year % 100);
343
- },
344
- 'Month': (moment) => {
345
- if (moment.month == null)
346
- return '';
347
- return moment.native.toLocaleString(undefined, { month: 'long' });
348
- },
349
- 'DD Month': (moment) => {
350
- return moment.native.toLocaleString(undefined, { day: '2-digit', month: 'long' });
351
- },
352
- 'D Month': (moment) => {
353
- return moment.native.toLocaleString(undefined, { day: 'numeric', month: 'long' });
354
- },
355
- 'Mon': (moment) => {
356
- if (moment.month == null)
357
- return '';
358
- return moment.native.toLocaleString(undefined, { month: 'short' });
359
- },
360
- 'DD Mon': (moment) => {
361
- return moment.native.toLocaleString(undefined, { day: '2-digit', month: 'short' });
362
- },
363
- 'D Mon': (moment) => {
364
- return moment.native.toLocaleString(undefined, { day: 'numeric', month: 'short' });
365
- },
366
- '-MM': (moment) => {
367
- if (moment.month == null)
368
- return '';
369
- return '-' + $mol_time_moment.patterns['MM'](moment);
370
- },
371
- 'MM': (moment) => {
372
- if (moment.month == null)
373
- return '';
374
- var month = moment.month + 1;
375
- return (month < 10)
376
- ? ('0' + month)
377
- : ('' + month);
378
- },
379
- 'M': (moment) => {
380
- if (moment.month == null)
381
- return '';
382
- return String(moment.month + 1);
383
- },
384
- 'WeekDay': (moment) => {
385
- if (moment.weekday == null)
386
- return '';
387
- return moment.native.toLocaleString(undefined, { weekday: 'long' });
388
- },
389
- 'WD': (moment) => {
390
- if (moment.weekday == null)
391
- return '';
392
- return moment.native.toLocaleString(undefined, { weekday: 'short' });
393
- },
394
- '-DD': (moment) => {
395
- if (moment.day == null)
396
- return '';
397
- return '-' + $mol_time_moment.patterns['DD'](moment);
398
- },
399
- 'DD': (moment) => {
400
- if (moment.day == null)
401
- return '';
402
- var day = moment.day + 1;
403
- return (day < 10)
404
- ? ('0' + day)
405
- : String(day);
406
- },
407
- 'D': (moment) => {
408
- if (moment.day == null)
409
- return '';
410
- return String(moment.day + 1);
411
- },
412
- 'Thh': (moment) => {
413
- if (moment.hour == null)
414
- return '';
415
- return 'T' + $mol_time_moment.patterns['hh'](moment);
416
- },
417
- 'hh': (moment) => {
418
- if (moment.hour == null)
419
- return '';
420
- return (moment.hour < 10)
421
- ? ('0' + moment.hour)
422
- : String(moment.hour);
423
- },
424
- 'h': (moment) => {
425
- if (moment.hour == null)
426
- return '';
427
- return String(moment.hour);
428
- },
429
- ':mm': (moment) => {
430
- if (moment.minute == null)
431
- return '';
432
- return ':' + $mol_time_moment.patterns['mm'](moment);
433
- },
434
- 'mm': (moment) => {
435
- if (moment.minute == null)
436
- return '';
437
- return (moment.minute < 10)
438
- ? ('0' + moment.minute)
439
- : String(moment.minute);
440
- },
441
- 'm': (moment) => {
442
- if (moment.minute == null)
443
- return '';
444
- return String(moment.minute);
445
- },
446
- ':ss': (moment) => {
447
- if (moment.second == null)
448
- return '';
449
- return ':' + $mol_time_moment.patterns['ss'](moment);
450
- },
451
- 'ss': (moment) => {
452
- if (moment.second == null)
453
- return '';
454
- var second = Math.floor(moment.second);
455
- return (second < 10)
456
- ? ('0' + second)
457
- : String(second);
458
- },
459
- 's': (moment) => {
460
- if (moment.second == null)
461
- return '';
462
- return String(Math.floor(moment.second));
463
- },
464
- '.sss': (moment) => {
465
- if (moment.second == null)
466
- return '';
467
- if (moment.second - Math.floor(moment.second) === 0)
468
- return '';
469
- return '.' + $mol_time_moment.patterns['sss'](moment);
470
- },
471
- 'sss': (moment) => {
472
- if (moment.second == null)
473
- return '';
474
- var millisecond = Math.floor((moment.second - Math.floor(moment.second)) * 1000);
475
- return (millisecond < 10)
476
- ? ('00' + millisecond)
477
- : (millisecond < 100)
478
- ? ('0' + millisecond)
479
- : String(millisecond);
480
- },
481
- 'Z': (moment) => {
482
- var offset = moment.offset;
483
- if (!offset)
484
- return '';
485
- return offset.toString('+hh:mm');
486
- }
487
- };
488
586
  $.$mol_time_moment = $mol_time_moment;
489
587
  })($ || ($ = {}));
490
588
  //moment.js.map
@@ -528,16 +626,19 @@ var $;
528
626
  if (config.duration !== undefined)
529
627
  this._duration = new $.$mol_time_duration(config.duration);
530
628
  }
629
+ _start;
531
630
  get start() {
532
631
  if (this._start)
533
632
  return this._start;
534
633
  return this._start = this._end.shift(this._duration.mult(-1));
535
634
  }
635
+ _end;
536
636
  get end() {
537
637
  if (this._end)
538
638
  return this._end;
539
639
  return this._end = this._start.shift(this._duration);
540
640
  }
641
+ _duration;
541
642
  get duration() {
542
643
  if (this._duration)
543
644
  return this._duration;
@@ -553,4 +654,4 @@ var $;
553
654
  //interval.js.map
554
655
  ;
555
656
  export default $
556
- //# sourceMappingURL=node.esm.js.map
657
+ //# sourceMappingURL=node.esm.js.map