@sbb-esta/lyne-elements-experimental-dev 5.1.0-dev.1783094110 → 5.1.0-dev.1783336064
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/core.js +1 -1
- package/development/core.js +124 -124
- package/development/journey-summary.pure.js +291 -291
- package/development/pearl-chain-time.pure.js +291 -291
- package/development/pearl-chain.pure.js +9 -9
- package/development/timetable-row.pure.js +291 -291
- package/journey-summary.pure.js +3 -3
- package/package.json +2 -2
- package/pearl-chain-time.pure.js +1 -1
- package/pearl-chain.pure.js +1 -1
- package/timetable-row.pure.js +2 -2
|
@@ -202,6 +202,133 @@ function toDate(argument, context) {
|
|
|
202
202
|
return constructFrom(context || argument, argument);
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
+
//#endregion
|
|
206
|
+
//#region node_modules/date-fns/_lib/defaultOptions.js
|
|
207
|
+
let defaultOptions = {};
|
|
208
|
+
function getDefaultOptions() {
|
|
209
|
+
return defaultOptions;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
//#endregion
|
|
213
|
+
//#region node_modules/date-fns/startOfWeek.js
|
|
214
|
+
/**
|
|
215
|
+
* The {@link startOfWeek} function options.
|
|
216
|
+
*/
|
|
217
|
+
/**
|
|
218
|
+
* @name startOfWeek
|
|
219
|
+
* @category Week Helpers
|
|
220
|
+
* @summary Return the start of a week for the given date.
|
|
221
|
+
*
|
|
222
|
+
* @description
|
|
223
|
+
* Return the start of a week for the given date.
|
|
224
|
+
* The result will be in the local timezone.
|
|
225
|
+
*
|
|
226
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
227
|
+
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
228
|
+
*
|
|
229
|
+
* @param date - The original date
|
|
230
|
+
* @param options - An object with options
|
|
231
|
+
*
|
|
232
|
+
* @returns The start of a week
|
|
233
|
+
*
|
|
234
|
+
* @example
|
|
235
|
+
* // The start of a week for 2 September 2014 11:55:00:
|
|
236
|
+
* const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0))
|
|
237
|
+
* //=> Sun Aug 31 2014 00:00:00
|
|
238
|
+
*
|
|
239
|
+
* @example
|
|
240
|
+
* // If the week starts on Monday, the start of the week for 2 September 2014 11:55:00:
|
|
241
|
+
* const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })
|
|
242
|
+
* //=> Mon Sep 01 2014 00:00:00
|
|
243
|
+
*/
|
|
244
|
+
function startOfWeek(date, options) {
|
|
245
|
+
const defaultOptions = getDefaultOptions();
|
|
246
|
+
const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions.weekStartsOn ?? defaultOptions.locale?.options?.weekStartsOn ?? 0;
|
|
247
|
+
const _date = toDate(date, options?.in);
|
|
248
|
+
const day = _date.getDay();
|
|
249
|
+
const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
|
|
250
|
+
_date.setDate(_date.getDate() - diff);
|
|
251
|
+
_date.setHours(0, 0, 0, 0);
|
|
252
|
+
return _date;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
//#endregion
|
|
256
|
+
//#region node_modules/date-fns/startOfISOWeek.js
|
|
257
|
+
/**
|
|
258
|
+
* The {@link startOfISOWeek} function options.
|
|
259
|
+
*/
|
|
260
|
+
/**
|
|
261
|
+
* @name startOfISOWeek
|
|
262
|
+
* @category ISO Week Helpers
|
|
263
|
+
* @summary Return the start of an ISO week for the given date.
|
|
264
|
+
*
|
|
265
|
+
* @description
|
|
266
|
+
* Return the start of an ISO week for the given date.
|
|
267
|
+
* The result will be in the local timezone.
|
|
268
|
+
*
|
|
269
|
+
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
|
|
270
|
+
*
|
|
271
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
272
|
+
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
273
|
+
*
|
|
274
|
+
* @param date - The original date
|
|
275
|
+
* @param options - An object with options
|
|
276
|
+
*
|
|
277
|
+
* @returns The start of an ISO week
|
|
278
|
+
*
|
|
279
|
+
* @example
|
|
280
|
+
* // The start of an ISO week for 2 September 2014 11:55:00:
|
|
281
|
+
* const result = startOfISOWeek(new Date(2014, 8, 2, 11, 55, 0))
|
|
282
|
+
* //=> Mon Sep 01 2014 00:00:00
|
|
283
|
+
*/
|
|
284
|
+
function startOfISOWeek(date, options) {
|
|
285
|
+
return startOfWeek(date, {
|
|
286
|
+
...options,
|
|
287
|
+
weekStartsOn: 1
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
//#endregion
|
|
292
|
+
//#region node_modules/date-fns/getISOWeekYear.js
|
|
293
|
+
/**
|
|
294
|
+
* The {@link getISOWeekYear} function options.
|
|
295
|
+
*/
|
|
296
|
+
/**
|
|
297
|
+
* @name getISOWeekYear
|
|
298
|
+
* @category ISO Week-Numbering Year Helpers
|
|
299
|
+
* @summary Get the ISO week-numbering year of the given date.
|
|
300
|
+
*
|
|
301
|
+
* @description
|
|
302
|
+
* Get the ISO week-numbering year of the given date,
|
|
303
|
+
* which always starts 3 days before the year's first Thursday.
|
|
304
|
+
*
|
|
305
|
+
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
|
|
306
|
+
*
|
|
307
|
+
* @param date - The given date
|
|
308
|
+
*
|
|
309
|
+
* @returns The ISO week-numbering year
|
|
310
|
+
*
|
|
311
|
+
* @example
|
|
312
|
+
* // Which ISO-week numbering year is 2 January 2005?
|
|
313
|
+
* const result = getISOWeekYear(new Date(2005, 0, 2))
|
|
314
|
+
* //=> 2004
|
|
315
|
+
*/
|
|
316
|
+
function getISOWeekYear(date, options) {
|
|
317
|
+
const _date = toDate(date, options?.in);
|
|
318
|
+
const year = _date.getFullYear();
|
|
319
|
+
const fourthOfJanuaryOfNextYear = constructFrom(_date, 0);
|
|
320
|
+
fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
|
|
321
|
+
fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
|
|
322
|
+
const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear);
|
|
323
|
+
const fourthOfJanuaryOfThisYear = constructFrom(_date, 0);
|
|
324
|
+
fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);
|
|
325
|
+
fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);
|
|
326
|
+
const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear);
|
|
327
|
+
if (_date.getTime() >= startOfNextYear.getTime()) return year + 1;
|
|
328
|
+
else if (_date.getTime() >= startOfThisYear.getTime()) return year;
|
|
329
|
+
else return year - 1;
|
|
330
|
+
}
|
|
331
|
+
|
|
205
332
|
//#endregion
|
|
206
333
|
//#region node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js
|
|
207
334
|
/**
|
|
@@ -307,6 +434,153 @@ function differenceInCalendarDays(laterDate, earlierDate, options) {
|
|
|
307
434
|
return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay);
|
|
308
435
|
}
|
|
309
436
|
|
|
437
|
+
//#endregion
|
|
438
|
+
//#region node_modules/date-fns/startOfISOWeekYear.js
|
|
439
|
+
/**
|
|
440
|
+
* The {@link startOfISOWeekYear} function options.
|
|
441
|
+
*/
|
|
442
|
+
/**
|
|
443
|
+
* @name startOfISOWeekYear
|
|
444
|
+
* @category ISO Week-Numbering Year Helpers
|
|
445
|
+
* @summary Return the start of an ISO week-numbering year for the given date.
|
|
446
|
+
*
|
|
447
|
+
* @description
|
|
448
|
+
* Return the start of an ISO week-numbering year,
|
|
449
|
+
* which always starts 3 days before the year's first Thursday.
|
|
450
|
+
* The result will be in the local timezone.
|
|
451
|
+
*
|
|
452
|
+
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
|
|
453
|
+
*
|
|
454
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
455
|
+
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
456
|
+
*
|
|
457
|
+
* @param date - The original date
|
|
458
|
+
* @param options - An object with options
|
|
459
|
+
*
|
|
460
|
+
* @returns The start of an ISO week-numbering year
|
|
461
|
+
*
|
|
462
|
+
* @example
|
|
463
|
+
* // The start of an ISO week-numbering year for 2 July 2005:
|
|
464
|
+
* const result = startOfISOWeekYear(new Date(2005, 6, 2))
|
|
465
|
+
* //=> Mon Jan 03 2005 00:00:00
|
|
466
|
+
*/
|
|
467
|
+
function startOfISOWeekYear(date, options) {
|
|
468
|
+
const year = getISOWeekYear(date, options);
|
|
469
|
+
const fourthOfJanuary = constructFrom(options?.in || date, 0);
|
|
470
|
+
fourthOfJanuary.setFullYear(year, 0, 4);
|
|
471
|
+
fourthOfJanuary.setHours(0, 0, 0, 0);
|
|
472
|
+
return startOfISOWeek(fourthOfJanuary);
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
//#endregion
|
|
476
|
+
//#region node_modules/date-fns/isDate.js
|
|
477
|
+
/**
|
|
478
|
+
* @name isDate
|
|
479
|
+
* @category Common Helpers
|
|
480
|
+
* @summary Is the given value a date?
|
|
481
|
+
*
|
|
482
|
+
* @description
|
|
483
|
+
* Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
|
|
484
|
+
*
|
|
485
|
+
* @param value - The value to check
|
|
486
|
+
*
|
|
487
|
+
* @returns True if the given value is a date
|
|
488
|
+
*
|
|
489
|
+
* @example
|
|
490
|
+
* // For a valid date:
|
|
491
|
+
* const result = isDate(new Date())
|
|
492
|
+
* //=> true
|
|
493
|
+
*
|
|
494
|
+
* @example
|
|
495
|
+
* // For an invalid date:
|
|
496
|
+
* const result = isDate(new Date(NaN))
|
|
497
|
+
* //=> true
|
|
498
|
+
*
|
|
499
|
+
* @example
|
|
500
|
+
* // For some value:
|
|
501
|
+
* const result = isDate('2014-02-31')
|
|
502
|
+
* //=> false
|
|
503
|
+
*
|
|
504
|
+
* @example
|
|
505
|
+
* // For an object:
|
|
506
|
+
* const result = isDate({})
|
|
507
|
+
* //=> false
|
|
508
|
+
*/
|
|
509
|
+
function isDate(value) {
|
|
510
|
+
return value instanceof Date || typeof value === "object" && Object.prototype.toString.call(value) === "[object Date]";
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
//#endregion
|
|
514
|
+
//#region node_modules/date-fns/isValid.js
|
|
515
|
+
/**
|
|
516
|
+
* @name isValid
|
|
517
|
+
* @category Common Helpers
|
|
518
|
+
* @summary Is the given date valid?
|
|
519
|
+
*
|
|
520
|
+
* @description
|
|
521
|
+
* Returns false if argument is Invalid Date and true otherwise.
|
|
522
|
+
* Argument is converted to Date using `toDate`. See [toDate](https://date-fns.org/docs/toDate)
|
|
523
|
+
* Invalid Date is a Date, whose time value is NaN.
|
|
524
|
+
*
|
|
525
|
+
* Time value of Date: http://es5.github.io/#x15.9.1.1
|
|
526
|
+
*
|
|
527
|
+
* @param date - The date to check
|
|
528
|
+
*
|
|
529
|
+
* @returns The date is valid
|
|
530
|
+
*
|
|
531
|
+
* @example
|
|
532
|
+
* // For the valid date:
|
|
533
|
+
* const result = isValid(new Date(2014, 1, 31))
|
|
534
|
+
* //=> true
|
|
535
|
+
*
|
|
536
|
+
* @example
|
|
537
|
+
* // For the value, convertible into a date:
|
|
538
|
+
* const result = isValid(1393804800000)
|
|
539
|
+
* //=> true
|
|
540
|
+
*
|
|
541
|
+
* @example
|
|
542
|
+
* // For the invalid date:
|
|
543
|
+
* const result = isValid(new Date(''))
|
|
544
|
+
* //=> false
|
|
545
|
+
*/
|
|
546
|
+
function isValid(date) {
|
|
547
|
+
return !(!isDate(date) && typeof date !== "number" || isNaN(+toDate(date)));
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
//#endregion
|
|
551
|
+
//#region node_modules/date-fns/startOfYear.js
|
|
552
|
+
/**
|
|
553
|
+
* The {@link startOfYear} function options.
|
|
554
|
+
*/
|
|
555
|
+
/**
|
|
556
|
+
* @name startOfYear
|
|
557
|
+
* @category Year Helpers
|
|
558
|
+
* @summary Return the start of a year for the given date.
|
|
559
|
+
*
|
|
560
|
+
* @description
|
|
561
|
+
* Return the start of a year for the given date.
|
|
562
|
+
* The result will be in the local timezone.
|
|
563
|
+
*
|
|
564
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
565
|
+
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
566
|
+
*
|
|
567
|
+
* @param date - The original date
|
|
568
|
+
* @param options - The options
|
|
569
|
+
*
|
|
570
|
+
* @returns The start of a year
|
|
571
|
+
*
|
|
572
|
+
* @example
|
|
573
|
+
* // The start of a year for 2 September 2014 11:55:00:
|
|
574
|
+
* const result = startOfYear(new Date(2014, 8, 2, 11, 55, 00))
|
|
575
|
+
* //=> Wed Jan 01 2014 00:00:00
|
|
576
|
+
*/
|
|
577
|
+
function startOfYear(date, options) {
|
|
578
|
+
const date_ = toDate(date, options?.in);
|
|
579
|
+
date_.setFullYear(date_.getFullYear(), 0, 1);
|
|
580
|
+
date_.setHours(0, 0, 0, 0);
|
|
581
|
+
return date_;
|
|
582
|
+
}
|
|
583
|
+
|
|
310
584
|
//#endregion
|
|
311
585
|
//#region node_modules/date-fns/locale/en-US/_lib/formatDistance.js
|
|
312
586
|
const formatDistanceLocale = {
|
|
@@ -886,65 +1160,24 @@ const match = {
|
|
|
886
1160
|
//#region node_modules/date-fns/locale/en-US.js
|
|
887
1161
|
/**
|
|
888
1162
|
* @category Locales
|
|
889
|
-
* @summary English locale (United States).
|
|
890
|
-
* @language English
|
|
891
|
-
* @iso-639-2 eng
|
|
892
|
-
* @author Sasha Koss [@kossnocorp](https://github.com/kossnocorp)
|
|
893
|
-
* @author Lesha Koss [@leshakoss](https://github.com/leshakoss)
|
|
894
|
-
*/
|
|
895
|
-
const enUS = {
|
|
896
|
-
code: "en-US",
|
|
897
|
-
formatDistance,
|
|
898
|
-
formatLong,
|
|
899
|
-
formatRelative,
|
|
900
|
-
localize,
|
|
901
|
-
match,
|
|
902
|
-
options: {
|
|
903
|
-
weekStartsOn: 0,
|
|
904
|
-
firstWeekContainsDate: 1
|
|
905
|
-
}
|
|
906
|
-
};
|
|
907
|
-
|
|
908
|
-
//#endregion
|
|
909
|
-
//#region node_modules/date-fns/_lib/defaultOptions.js
|
|
910
|
-
let defaultOptions = {};
|
|
911
|
-
function getDefaultOptions() {
|
|
912
|
-
return defaultOptions;
|
|
913
|
-
}
|
|
914
|
-
|
|
915
|
-
//#endregion
|
|
916
|
-
//#region node_modules/date-fns/startOfYear.js
|
|
917
|
-
/**
|
|
918
|
-
* The {@link startOfYear} function options.
|
|
919
|
-
*/
|
|
920
|
-
/**
|
|
921
|
-
* @name startOfYear
|
|
922
|
-
* @category Year Helpers
|
|
923
|
-
* @summary Return the start of a year for the given date.
|
|
924
|
-
*
|
|
925
|
-
* @description
|
|
926
|
-
* Return the start of a year for the given date.
|
|
927
|
-
* The result will be in the local timezone.
|
|
928
|
-
*
|
|
929
|
-
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
930
|
-
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
931
|
-
*
|
|
932
|
-
* @param date - The original date
|
|
933
|
-
* @param options - The options
|
|
934
|
-
*
|
|
935
|
-
* @returns The start of a year
|
|
936
|
-
*
|
|
937
|
-
* @example
|
|
938
|
-
* // The start of a year for 2 September 2014 11:55:00:
|
|
939
|
-
* const result = startOfYear(new Date(2014, 8, 2, 11, 55, 00))
|
|
940
|
-
* //=> Wed Jan 01 2014 00:00:00
|
|
1163
|
+
* @summary English locale (United States).
|
|
1164
|
+
* @language English
|
|
1165
|
+
* @iso-639-2 eng
|
|
1166
|
+
* @author Sasha Koss [@kossnocorp](https://github.com/kossnocorp)
|
|
1167
|
+
* @author Lesha Koss [@leshakoss](https://github.com/leshakoss)
|
|
941
1168
|
*/
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
1169
|
+
const enUS = {
|
|
1170
|
+
code: "en-US",
|
|
1171
|
+
formatDistance,
|
|
1172
|
+
formatLong,
|
|
1173
|
+
formatRelative,
|
|
1174
|
+
localize,
|
|
1175
|
+
match,
|
|
1176
|
+
options: {
|
|
1177
|
+
weekStartsOn: 0,
|
|
1178
|
+
firstWeekContainsDate: 1
|
|
1179
|
+
}
|
|
1180
|
+
};
|
|
948
1181
|
|
|
949
1182
|
//#endregion
|
|
950
1183
|
//#region node_modules/date-fns/getDayOfYear.js
|
|
@@ -974,164 +1207,6 @@ function getDayOfYear(date, options) {
|
|
|
974
1207
|
return differenceInCalendarDays(_date, startOfYear(_date)) + 1;
|
|
975
1208
|
}
|
|
976
1209
|
|
|
977
|
-
//#endregion
|
|
978
|
-
//#region node_modules/date-fns/startOfWeek.js
|
|
979
|
-
/**
|
|
980
|
-
* The {@link startOfWeek} function options.
|
|
981
|
-
*/
|
|
982
|
-
/**
|
|
983
|
-
* @name startOfWeek
|
|
984
|
-
* @category Week Helpers
|
|
985
|
-
* @summary Return the start of a week for the given date.
|
|
986
|
-
*
|
|
987
|
-
* @description
|
|
988
|
-
* Return the start of a week for the given date.
|
|
989
|
-
* The result will be in the local timezone.
|
|
990
|
-
*
|
|
991
|
-
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
992
|
-
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
993
|
-
*
|
|
994
|
-
* @param date - The original date
|
|
995
|
-
* @param options - An object with options
|
|
996
|
-
*
|
|
997
|
-
* @returns The start of a week
|
|
998
|
-
*
|
|
999
|
-
* @example
|
|
1000
|
-
* // The start of a week for 2 September 2014 11:55:00:
|
|
1001
|
-
* const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0))
|
|
1002
|
-
* //=> Sun Aug 31 2014 00:00:00
|
|
1003
|
-
*
|
|
1004
|
-
* @example
|
|
1005
|
-
* // If the week starts on Monday, the start of the week for 2 September 2014 11:55:00:
|
|
1006
|
-
* const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })
|
|
1007
|
-
* //=> Mon Sep 01 2014 00:00:00
|
|
1008
|
-
*/
|
|
1009
|
-
function startOfWeek(date, options) {
|
|
1010
|
-
const defaultOptions = getDefaultOptions();
|
|
1011
|
-
const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions.weekStartsOn ?? defaultOptions.locale?.options?.weekStartsOn ?? 0;
|
|
1012
|
-
const _date = toDate(date, options?.in);
|
|
1013
|
-
const day = _date.getDay();
|
|
1014
|
-
const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
|
|
1015
|
-
_date.setDate(_date.getDate() - diff);
|
|
1016
|
-
_date.setHours(0, 0, 0, 0);
|
|
1017
|
-
return _date;
|
|
1018
|
-
}
|
|
1019
|
-
|
|
1020
|
-
//#endregion
|
|
1021
|
-
//#region node_modules/date-fns/startOfISOWeek.js
|
|
1022
|
-
/**
|
|
1023
|
-
* The {@link startOfISOWeek} function options.
|
|
1024
|
-
*/
|
|
1025
|
-
/**
|
|
1026
|
-
* @name startOfISOWeek
|
|
1027
|
-
* @category ISO Week Helpers
|
|
1028
|
-
* @summary Return the start of an ISO week for the given date.
|
|
1029
|
-
*
|
|
1030
|
-
* @description
|
|
1031
|
-
* Return the start of an ISO week for the given date.
|
|
1032
|
-
* The result will be in the local timezone.
|
|
1033
|
-
*
|
|
1034
|
-
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
|
|
1035
|
-
*
|
|
1036
|
-
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
1037
|
-
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
1038
|
-
*
|
|
1039
|
-
* @param date - The original date
|
|
1040
|
-
* @param options - An object with options
|
|
1041
|
-
*
|
|
1042
|
-
* @returns The start of an ISO week
|
|
1043
|
-
*
|
|
1044
|
-
* @example
|
|
1045
|
-
* // The start of an ISO week for 2 September 2014 11:55:00:
|
|
1046
|
-
* const result = startOfISOWeek(new Date(2014, 8, 2, 11, 55, 0))
|
|
1047
|
-
* //=> Mon Sep 01 2014 00:00:00
|
|
1048
|
-
*/
|
|
1049
|
-
function startOfISOWeek(date, options) {
|
|
1050
|
-
return startOfWeek(date, {
|
|
1051
|
-
...options,
|
|
1052
|
-
weekStartsOn: 1
|
|
1053
|
-
});
|
|
1054
|
-
}
|
|
1055
|
-
|
|
1056
|
-
//#endregion
|
|
1057
|
-
//#region node_modules/date-fns/getISOWeekYear.js
|
|
1058
|
-
/**
|
|
1059
|
-
* The {@link getISOWeekYear} function options.
|
|
1060
|
-
*/
|
|
1061
|
-
/**
|
|
1062
|
-
* @name getISOWeekYear
|
|
1063
|
-
* @category ISO Week-Numbering Year Helpers
|
|
1064
|
-
* @summary Get the ISO week-numbering year of the given date.
|
|
1065
|
-
*
|
|
1066
|
-
* @description
|
|
1067
|
-
* Get the ISO week-numbering year of the given date,
|
|
1068
|
-
* which always starts 3 days before the year's first Thursday.
|
|
1069
|
-
*
|
|
1070
|
-
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
|
|
1071
|
-
*
|
|
1072
|
-
* @param date - The given date
|
|
1073
|
-
*
|
|
1074
|
-
* @returns The ISO week-numbering year
|
|
1075
|
-
*
|
|
1076
|
-
* @example
|
|
1077
|
-
* // Which ISO-week numbering year is 2 January 2005?
|
|
1078
|
-
* const result = getISOWeekYear(new Date(2005, 0, 2))
|
|
1079
|
-
* //=> 2004
|
|
1080
|
-
*/
|
|
1081
|
-
function getISOWeekYear(date, options) {
|
|
1082
|
-
const _date = toDate(date, options?.in);
|
|
1083
|
-
const year = _date.getFullYear();
|
|
1084
|
-
const fourthOfJanuaryOfNextYear = constructFrom(_date, 0);
|
|
1085
|
-
fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
|
|
1086
|
-
fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
|
|
1087
|
-
const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear);
|
|
1088
|
-
const fourthOfJanuaryOfThisYear = constructFrom(_date, 0);
|
|
1089
|
-
fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);
|
|
1090
|
-
fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);
|
|
1091
|
-
const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear);
|
|
1092
|
-
if (_date.getTime() >= startOfNextYear.getTime()) return year + 1;
|
|
1093
|
-
else if (_date.getTime() >= startOfThisYear.getTime()) return year;
|
|
1094
|
-
else return year - 1;
|
|
1095
|
-
}
|
|
1096
|
-
|
|
1097
|
-
//#endregion
|
|
1098
|
-
//#region node_modules/date-fns/startOfISOWeekYear.js
|
|
1099
|
-
/**
|
|
1100
|
-
* The {@link startOfISOWeekYear} function options.
|
|
1101
|
-
*/
|
|
1102
|
-
/**
|
|
1103
|
-
* @name startOfISOWeekYear
|
|
1104
|
-
* @category ISO Week-Numbering Year Helpers
|
|
1105
|
-
* @summary Return the start of an ISO week-numbering year for the given date.
|
|
1106
|
-
*
|
|
1107
|
-
* @description
|
|
1108
|
-
* Return the start of an ISO week-numbering year,
|
|
1109
|
-
* which always starts 3 days before the year's first Thursday.
|
|
1110
|
-
* The result will be in the local timezone.
|
|
1111
|
-
*
|
|
1112
|
-
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
|
|
1113
|
-
*
|
|
1114
|
-
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
1115
|
-
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
1116
|
-
*
|
|
1117
|
-
* @param date - The original date
|
|
1118
|
-
* @param options - An object with options
|
|
1119
|
-
*
|
|
1120
|
-
* @returns The start of an ISO week-numbering year
|
|
1121
|
-
*
|
|
1122
|
-
* @example
|
|
1123
|
-
* // The start of an ISO week-numbering year for 2 July 2005:
|
|
1124
|
-
* const result = startOfISOWeekYear(new Date(2005, 6, 2))
|
|
1125
|
-
* //=> Mon Jan 03 2005 00:00:00
|
|
1126
|
-
*/
|
|
1127
|
-
function startOfISOWeekYear(date, options) {
|
|
1128
|
-
const year = getISOWeekYear(date, options);
|
|
1129
|
-
const fourthOfJanuary = constructFrom(options?.in || date, 0);
|
|
1130
|
-
fourthOfJanuary.setFullYear(year, 0, 4);
|
|
1131
|
-
fourthOfJanuary.setHours(0, 0, 0, 0);
|
|
1132
|
-
return startOfISOWeek(fourthOfJanuary);
|
|
1133
|
-
}
|
|
1134
|
-
|
|
1135
1210
|
//#endregion
|
|
1136
1211
|
//#region node_modules/date-fns/getISOWeek.js
|
|
1137
1212
|
/**
|
|
@@ -1849,81 +1924,6 @@ function message(token, format, input) {
|
|
|
1849
1924
|
return `Use \`${token.toLowerCase()}\` instead of \`${token}\` (in \`${format}\`) for formatting ${subject} to the input \`${input}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
|
|
1850
1925
|
}
|
|
1851
1926
|
|
|
1852
|
-
//#endregion
|
|
1853
|
-
//#region node_modules/date-fns/isDate.js
|
|
1854
|
-
/**
|
|
1855
|
-
* @name isDate
|
|
1856
|
-
* @category Common Helpers
|
|
1857
|
-
* @summary Is the given value a date?
|
|
1858
|
-
*
|
|
1859
|
-
* @description
|
|
1860
|
-
* Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
|
|
1861
|
-
*
|
|
1862
|
-
* @param value - The value to check
|
|
1863
|
-
*
|
|
1864
|
-
* @returns True if the given value is a date
|
|
1865
|
-
*
|
|
1866
|
-
* @example
|
|
1867
|
-
* // For a valid date:
|
|
1868
|
-
* const result = isDate(new Date())
|
|
1869
|
-
* //=> true
|
|
1870
|
-
*
|
|
1871
|
-
* @example
|
|
1872
|
-
* // For an invalid date:
|
|
1873
|
-
* const result = isDate(new Date(NaN))
|
|
1874
|
-
* //=> true
|
|
1875
|
-
*
|
|
1876
|
-
* @example
|
|
1877
|
-
* // For some value:
|
|
1878
|
-
* const result = isDate('2014-02-31')
|
|
1879
|
-
* //=> false
|
|
1880
|
-
*
|
|
1881
|
-
* @example
|
|
1882
|
-
* // For an object:
|
|
1883
|
-
* const result = isDate({})
|
|
1884
|
-
* //=> false
|
|
1885
|
-
*/
|
|
1886
|
-
function isDate(value) {
|
|
1887
|
-
return value instanceof Date || typeof value === "object" && Object.prototype.toString.call(value) === "[object Date]";
|
|
1888
|
-
}
|
|
1889
|
-
|
|
1890
|
-
//#endregion
|
|
1891
|
-
//#region node_modules/date-fns/isValid.js
|
|
1892
|
-
/**
|
|
1893
|
-
* @name isValid
|
|
1894
|
-
* @category Common Helpers
|
|
1895
|
-
* @summary Is the given date valid?
|
|
1896
|
-
*
|
|
1897
|
-
* @description
|
|
1898
|
-
* Returns false if argument is Invalid Date and true otherwise.
|
|
1899
|
-
* Argument is converted to Date using `toDate`. See [toDate](https://date-fns.org/docs/toDate)
|
|
1900
|
-
* Invalid Date is a Date, whose time value is NaN.
|
|
1901
|
-
*
|
|
1902
|
-
* Time value of Date: http://es5.github.io/#x15.9.1.1
|
|
1903
|
-
*
|
|
1904
|
-
* @param date - The date to check
|
|
1905
|
-
*
|
|
1906
|
-
* @returns The date is valid
|
|
1907
|
-
*
|
|
1908
|
-
* @example
|
|
1909
|
-
* // For the valid date:
|
|
1910
|
-
* const result = isValid(new Date(2014, 1, 31))
|
|
1911
|
-
* //=> true
|
|
1912
|
-
*
|
|
1913
|
-
* @example
|
|
1914
|
-
* // For the value, convertible into a date:
|
|
1915
|
-
* const result = isValid(1393804800000)
|
|
1916
|
-
* //=> true
|
|
1917
|
-
*
|
|
1918
|
-
* @example
|
|
1919
|
-
* // For the invalid date:
|
|
1920
|
-
* const result = isValid(new Date(''))
|
|
1921
|
-
* //=> false
|
|
1922
|
-
*/
|
|
1923
|
-
function isValid(date) {
|
|
1924
|
-
return !(!isDate(date) && typeof date !== "number" || isNaN(+toDate(date)));
|
|
1925
|
-
}
|
|
1926
|
-
|
|
1927
1927
|
//#endregion
|
|
1928
1928
|
//#region node_modules/date-fns/format.js
|
|
1929
1929
|
const formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
|