@internationalized/date 3.12.0 → 3.12.1
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/dist/index.cjs +113 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +45 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +45 -0
- package/dist/index.mjs.map +1 -0
- package/dist/{CalendarDate.main.js → private/CalendarDate.cjs} +102 -120
- package/dist/private/CalendarDate.cjs.map +1 -0
- package/dist/{CalendarDate.mjs → private/CalendarDate.js} +65 -65
- package/dist/private/CalendarDate.js.map +1 -0
- package/dist/{CalendarDate.module.js → private/CalendarDate.mjs} +99 -117
- package/dist/private/CalendarDate.mjs.map +1 -0
- package/dist/{DateFormatter.main.js → private/DateFormatter.cjs} +27 -27
- package/dist/private/DateFormatter.cjs.map +1 -0
- package/dist/{DateFormatter.module.js → private/DateFormatter.js} +23 -23
- package/dist/{DateFormatter.module.js.map → private/DateFormatter.js.map} +1 -1
- package/dist/{DateFormatter.mjs → private/DateFormatter.mjs} +27 -27
- package/dist/private/DateFormatter.mjs.map +1 -0
- package/dist/{BuddhistCalendar.main.js → private/calendars/BuddhistCalendar.cjs} +13 -13
- package/dist/{BuddhistCalendar.main.js.map → private/calendars/BuddhistCalendar.cjs.map} +1 -1
- package/dist/{BuddhistCalendar.module.js → private/calendars/BuddhistCalendar.js} +13 -13
- package/dist/{BuddhistCalendar.module.js.map → private/calendars/BuddhistCalendar.js.map} +1 -1
- package/dist/{BuddhistCalendar.mjs → private/calendars/BuddhistCalendar.mjs} +13 -13
- package/dist/private/calendars/BuddhistCalendar.mjs.map +1 -0
- package/dist/{EthiopicCalendar.main.js → private/calendars/EthiopicCalendar.cjs} +32 -32
- package/dist/{EthiopicCalendar.main.js.map → private/calendars/EthiopicCalendar.cjs.map} +1 -1
- package/dist/{EthiopicCalendar.module.js → private/calendars/EthiopicCalendar.js} +30 -30
- package/dist/{EthiopicCalendar.module.js.map → private/calendars/EthiopicCalendar.js.map} +1 -1
- package/dist/{EthiopicCalendar.mjs → private/calendars/EthiopicCalendar.mjs} +30 -30
- package/dist/private/calendars/EthiopicCalendar.mjs.map +1 -0
- package/dist/{GregorianCalendar.main.js → private/calendars/GregorianCalendar.cjs} +31 -31
- package/dist/{GregorianCalendar.main.js.map → private/calendars/GregorianCalendar.cjs.map} +1 -1
- package/dist/{GregorianCalendar.module.js → private/calendars/GregorianCalendar.js} +27 -27
- package/dist/{GregorianCalendar.module.js.map → private/calendars/GregorianCalendar.js.map} +1 -1
- package/dist/{GregorianCalendar.mjs → private/calendars/GregorianCalendar.mjs} +27 -27
- package/dist/private/calendars/GregorianCalendar.mjs.map +1 -0
- package/dist/{HebrewCalendar.main.js → private/calendars/HebrewCalendar.cjs} +44 -44
- package/dist/{HebrewCalendar.main.js.map → private/calendars/HebrewCalendar.cjs.map} +1 -1
- package/dist/{HebrewCalendar.module.js → private/calendars/HebrewCalendar.js} +44 -44
- package/dist/{HebrewCalendar.module.js.map → private/calendars/HebrewCalendar.js.map} +1 -1
- package/dist/{HebrewCalendar.mjs → private/calendars/HebrewCalendar.mjs} +44 -44
- package/dist/private/calendars/HebrewCalendar.mjs.map +1 -0
- package/dist/{IndianCalendar.main.js → private/calendars/IndianCalendar.cjs} +20 -20
- package/dist/{IndianCalendar.main.js.map → private/calendars/IndianCalendar.cjs.map} +1 -1
- package/dist/{IndianCalendar.module.js → private/calendars/IndianCalendar.js} +20 -20
- package/dist/{IndianCalendar.module.js.map → private/calendars/IndianCalendar.js.map} +1 -1
- package/dist/{IndianCalendar.mjs → private/calendars/IndianCalendar.mjs} +20 -20
- package/dist/private/calendars/IndianCalendar.mjs.map +1 -0
- package/dist/private/calendars/IslamicCalendar.cjs +168 -0
- package/dist/private/calendars/IslamicCalendar.cjs.map +1 -0
- package/dist/private/calendars/IslamicCalendar.js +161 -0
- package/dist/{IslamicCalendar.module.js.map → private/calendars/IslamicCalendar.js.map} +1 -1
- package/dist/private/calendars/IslamicCalendar.mjs +161 -0
- package/dist/private/calendars/IslamicCalendar.mjs.map +1 -0
- package/dist/{JapaneseCalendar.main.js → private/calendars/JapaneseCalendar.cjs} +37 -37
- package/dist/{JapaneseCalendar.main.js.map → private/calendars/JapaneseCalendar.cjs.map} +1 -1
- package/dist/{JapaneseCalendar.module.js → private/calendars/JapaneseCalendar.js} +37 -37
- package/dist/{JapaneseCalendar.module.js.map → private/calendars/JapaneseCalendar.js.map} +1 -1
- package/dist/{JapaneseCalendar.mjs → private/calendars/JapaneseCalendar.mjs} +37 -37
- package/dist/private/calendars/JapaneseCalendar.mjs.map +1 -0
- package/dist/{PersianCalendar.main.js → private/calendars/PersianCalendar.cjs} +13 -13
- package/dist/{PersianCalendar.main.js.map → private/calendars/PersianCalendar.cjs.map} +1 -1
- package/dist/{PersianCalendar.module.js → private/calendars/PersianCalendar.js} +13 -13
- package/dist/{PersianCalendar.module.js.map → private/calendars/PersianCalendar.js.map} +1 -1
- package/dist/{PersianCalendar.mjs → private/calendars/PersianCalendar.mjs} +13 -13
- package/dist/private/calendars/PersianCalendar.mjs.map +1 -0
- package/dist/{TaiwanCalendar.main.js → private/calendars/TaiwanCalendar.cjs} +20 -20
- package/dist/{TaiwanCalendar.main.js.map → private/calendars/TaiwanCalendar.cjs.map} +1 -1
- package/dist/private/calendars/TaiwanCalendar.js +75 -0
- package/dist/{TaiwanCalendar.module.js.map → private/calendars/TaiwanCalendar.js.map} +1 -1
- package/dist/{TaiwanCalendar.mjs → private/calendars/TaiwanCalendar.mjs} +20 -20
- package/dist/private/calendars/TaiwanCalendar.mjs.map +1 -0
- package/dist/{conversion.main.js → private/conversion.cjs} +85 -85
- package/dist/{conversion.main.js.map → private/conversion.cjs.map} +1 -1
- package/dist/{conversion.module.js → private/conversion.js} +71 -71
- package/dist/{conversion.module.js.map → private/conversion.js.map} +1 -1
- package/dist/{conversion.mjs → private/conversion.mjs} +71 -71
- package/dist/private/conversion.mjs.map +1 -0
- package/dist/private/createCalendar.cjs +69 -0
- package/dist/{createCalendar.main.js.map → private/createCalendar.cjs.map} +1 -1
- package/dist/private/createCalendar.js +64 -0
- package/dist/{createCalendar.module.js.map → private/createCalendar.js.map} +1 -1
- package/dist/private/createCalendar.mjs +64 -0
- package/dist/private/createCalendar.mjs.map +1 -0
- package/dist/{manipulation.main.js → private/manipulation.cjs} +106 -109
- package/dist/private/manipulation.cjs.map +1 -0
- package/dist/{manipulation.mjs → private/manipulation.js} +88 -88
- package/dist/{manipulation.module.js.map → private/manipulation.js.map} +1 -1
- package/dist/{manipulation.module.js → private/manipulation.mjs} +93 -96
- package/dist/private/manipulation.mjs.map +1 -0
- package/dist/private/queries.cjs +359 -0
- package/dist/private/queries.cjs.map +1 -0
- package/dist/private/queries.js +326 -0
- package/dist/private/queries.js.map +1 -0
- package/dist/private/queries.mjs +324 -0
- package/dist/private/queries.mjs.map +1 -0
- package/dist/private/string.cjs +181 -0
- package/dist/private/string.cjs.map +1 -0
- package/dist/{string.mjs → private/string.js} +64 -64
- package/dist/{string.module.js.map → private/string.js.map} +1 -1
- package/dist/private/string.mjs +166 -0
- package/dist/private/string.mjs.map +1 -0
- package/dist/{utils.main.js → private/utils.cjs} +3 -3
- package/dist/{utils.main.js.map → private/utils.cjs.map} +1 -1
- package/dist/{utils.module.js → private/utils.js} +3 -3
- package/dist/{utils.module.js.map → private/utils.js.map} +1 -1
- package/dist/{utils.mjs → private/utils.mjs} +3 -3
- package/dist/private/utils.mjs.map +1 -0
- package/dist/{weekStartData.main.js → private/weekStartData.cjs} +3 -3
- package/dist/{weekStartData.main.js.map → private/weekStartData.cjs.map} +1 -1
- package/dist/{weekStartData.module.js → private/weekStartData.js} +3 -3
- package/dist/{weekStartData.module.js.map → private/weekStartData.js.map} +1 -1
- package/dist/{weekStartData.mjs → private/weekStartData.mjs} +3 -3
- package/dist/private/weekStartData.mjs.map +1 -0
- package/dist/types/src/CalendarDate.d.ts +177 -0
- package/dist/types/src/DateFormatter.d.ts +21 -0
- package/dist/types/src/calendars/BuddhistCalendar.d.ts +16 -0
- package/dist/types/src/calendars/EthiopicCalendar.d.ts +45 -0
- package/dist/types/src/calendars/GregorianCalendar.d.ts +25 -0
- package/dist/types/src/calendars/HebrewCalendar.d.ts +21 -0
- package/dist/types/src/calendars/IndianCalendar.d.ts +17 -0
- package/dist/types/src/calendars/IslamicCalendar.d.ts +48 -0
- package/dist/types/src/calendars/JapaneseCalendar.d.ts +21 -0
- package/dist/types/src/calendars/PersianCalendar.d.ts +19 -0
- package/dist/types/src/calendars/TaiwanCalendar.d.ts +19 -0
- package/dist/types/src/conversion.d.ts +42 -0
- package/dist/types/src/createCalendar.d.ts +3 -0
- package/dist/types/src/index.d.ts +17 -0
- package/dist/types/src/manipulation.d.ts +25 -0
- package/dist/types/src/queries.d.ts +87 -0
- package/dist/types/src/string.d.ts +35 -0
- package/dist/types/src/types.d.ts +132 -0
- package/dist/types/src/utils.d.ts +4 -0
- package/dist/types/src/weekStartData.d.ts +97 -0
- package/package.json +26 -11
- package/src/CalendarDate.ts +2 -0
- package/src/index.ts +1 -0
- package/src/queries.ts +1 -3
- package/dist/CalendarDate.main.js.map +0 -1
- package/dist/CalendarDate.module.js.map +0 -1
- package/dist/DateFormatter.main.js.map +0 -1
- package/dist/IslamicCalendar.main.js +0 -168
- package/dist/IslamicCalendar.main.js.map +0 -1
- package/dist/IslamicCalendar.mjs +0 -161
- package/dist/IslamicCalendar.module.js +0 -161
- package/dist/TaiwanCalendar.module.js +0 -75
- package/dist/createCalendar.main.js +0 -69
- package/dist/createCalendar.mjs +0 -64
- package/dist/createCalendar.module.js +0 -64
- package/dist/import.mjs +0 -45
- package/dist/main.js +0 -113
- package/dist/main.js.map +0 -1
- package/dist/manipulation.main.js.map +0 -1
- package/dist/module.js +0 -45
- package/dist/module.js.map +0 -1
- package/dist/queries.main.js +0 -361
- package/dist/queries.main.js.map +0 -1
- package/dist/queries.mjs +0 -326
- package/dist/queries.module.js +0 -326
- package/dist/queries.module.js.map +0 -1
- package/dist/string.main.js +0 -190
- package/dist/string.main.js.map +0 -1
- package/dist/string.module.js +0 -175
- package/dist/types.d.ts +0 -672
- package/dist/types.d.ts.map +0 -1
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {add as $
|
|
2
|
-
import {compareDate as $
|
|
3
|
-
import {dateTimeToString as $
|
|
4
|
-
import {GregorianCalendar as $
|
|
5
|
-
import {toCalendarDateTime as $
|
|
6
|
-
import {_ as $aksy1$_} from "@swc/helpers/_/_class_private_field_init";
|
|
1
|
+
import {add as $435a2ceaa8778ed8$export$e16d8520af44a096, addTime as $435a2ceaa8778ed8$export$7ed87b6bc2506470, addZoned as $435a2ceaa8778ed8$export$96b1d28349274637, constrain as $435a2ceaa8778ed8$export$c4e2ecac49351ef2, constrainTime as $435a2ceaa8778ed8$export$7555de1e070510cb, cycleDate as $435a2ceaa8778ed8$export$d52ced6badfb9a4c, cycleTime as $435a2ceaa8778ed8$export$dd02b3e0007dfe28, cycleZoned as $435a2ceaa8778ed8$export$9a297d111fc86b79, set as $435a2ceaa8778ed8$export$adaa4cf7ef1b65be, setTime as $435a2ceaa8778ed8$export$e5d5e1c1822b6e56, setZoned as $435a2ceaa8778ed8$export$31b5430eb18be4f8, subtract as $435a2ceaa8778ed8$export$4e2d2ead65e5f7e3, subtractTime as $435a2ceaa8778ed8$export$fe34d3a381cd7501, subtractZoned as $435a2ceaa8778ed8$export$6814caac34ca03c7} from "./manipulation.mjs";
|
|
2
|
+
import {compareDate as $ad063034c8620db8$export$68781ddf31c0090f, compareTime as $ad063034c8620db8$export$c19a80a9721b80f6} from "./queries.mjs";
|
|
3
|
+
import {dateTimeToString as $58246871e4652552$export$4223de14708adc63, dateToString as $58246871e4652552$export$60dfd74aa96791bd, timeToString as $58246871e4652552$export$f59dee82248f5ad4, zonedDateTimeToString as $58246871e4652552$export$bf79f1ebf4b18792} from "./string.mjs";
|
|
4
|
+
import {GregorianCalendar as $93635573935797de$export$80ee6245ec4f29ec} from "./calendars/GregorianCalendar.mjs";
|
|
5
|
+
import {toCalendarDateTime as $d07e34cce18680fd$export$b21e0b124e224484, toDate as $d07e34cce18680fd$export$e67a095c620b86fe, toZoned as $d07e34cce18680fd$export$84c95a83c799e074, zonedToDate as $d07e34cce18680fd$export$83aac07b4c37b25} from "./conversion.mjs";
|
|
7
6
|
|
|
8
7
|
/*
|
|
9
8
|
* Copyright 2020 Adobe. All rights reserved.
|
|
@@ -20,9 +19,8 @@ import {_ as $aksy1$_} from "@swc/helpers/_/_class_private_field_init";
|
|
|
20
19
|
|
|
21
20
|
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
let calendar = typeof args[0] === 'object' ? args.shift() : new (0, $3b62074eb05584b2$export$80ee6245ec4f29ec)();
|
|
22
|
+
function $2aaf608024c21ca1$var$shiftArgs(args) {
|
|
23
|
+
let calendar = typeof args[0] === 'object' ? args.shift() : new (0, $93635573935797de$export$80ee6245ec4f29ec)();
|
|
26
24
|
let era;
|
|
27
25
|
if (typeof args[0] === 'string') era = args.shift();
|
|
28
26
|
else {
|
|
@@ -40,110 +38,115 @@ function $35ea8db9cb2ccb90$var$shiftArgs(args) {
|
|
|
40
38
|
day
|
|
41
39
|
];
|
|
42
40
|
}
|
|
43
|
-
|
|
44
|
-
//
|
|
45
|
-
//
|
|
46
|
-
//
|
|
47
|
-
|
|
48
|
-
|
|
41
|
+
class $2aaf608024c21ca1$export$99faa760c7908e4f {
|
|
42
|
+
// This prevents TypeScript from allowing other types with the same fields to match.
|
|
43
|
+
// i.e. a ZonedDateTime should not be be passable to a parameter that expects CalendarDate.
|
|
44
|
+
// If that behavior is desired, use the AnyCalendarDate interface instead.
|
|
45
|
+
// @ts-ignore
|
|
46
|
+
#type;
|
|
47
|
+
constructor(...args){
|
|
48
|
+
let [calendar, era, year, month, day] = $2aaf608024c21ca1$var$shiftArgs(args);
|
|
49
|
+
this.calendar = calendar;
|
|
50
|
+
this.era = era;
|
|
51
|
+
this.year = year;
|
|
52
|
+
this.month = month;
|
|
53
|
+
this.day = day;
|
|
54
|
+
(0, $435a2ceaa8778ed8$export$c4e2ecac49351ef2)(this);
|
|
55
|
+
}
|
|
49
56
|
/** Returns a copy of this date. */ copy() {
|
|
50
|
-
if (this.era) return new $
|
|
51
|
-
else return new $
|
|
57
|
+
if (this.era) return new $2aaf608024c21ca1$export$99faa760c7908e4f(this.calendar, this.era, this.year, this.month, this.day);
|
|
58
|
+
else return new $2aaf608024c21ca1$export$99faa760c7908e4f(this.calendar, this.year, this.month, this.day);
|
|
52
59
|
}
|
|
53
60
|
/** Returns a new `CalendarDate` with the given duration added to it. */ add(duration) {
|
|
54
|
-
return (0, $
|
|
61
|
+
return (0, $435a2ceaa8778ed8$export$e16d8520af44a096)(this, duration);
|
|
55
62
|
}
|
|
56
63
|
/** Returns a new `CalendarDate` with the given duration subtracted from it. */ subtract(duration) {
|
|
57
|
-
return (0, $
|
|
64
|
+
return (0, $435a2ceaa8778ed8$export$4e2d2ead65e5f7e3)(this, duration);
|
|
58
65
|
}
|
|
59
66
|
/** Returns a new `CalendarDate` with the given fields set to the provided values. Other fields will be constrained accordingly. */ set(fields) {
|
|
60
|
-
return (0, $
|
|
67
|
+
return (0, $435a2ceaa8778ed8$export$adaa4cf7ef1b65be)(this, fields);
|
|
61
68
|
}
|
|
62
69
|
/**
|
|
63
70
|
* Returns a new `CalendarDate` with the given field adjusted by a specified amount.
|
|
64
71
|
* When the resulting value reaches the limits of the field, it wraps around.
|
|
65
72
|
*/ cycle(field, amount, options) {
|
|
66
|
-
return (0, $
|
|
73
|
+
return (0, $435a2ceaa8778ed8$export$d52ced6badfb9a4c)(this, field, amount, options);
|
|
67
74
|
}
|
|
68
75
|
/** Converts the date to a native JavaScript Date object, with the time set to midnight in the given time zone. */ toDate(timeZone) {
|
|
69
|
-
return (0, $
|
|
76
|
+
return (0, $d07e34cce18680fd$export$e67a095c620b86fe)(this, timeZone);
|
|
70
77
|
}
|
|
71
78
|
/** Converts the date to an ISO 8601 formatted string. */ toString() {
|
|
72
|
-
return (0, $
|
|
79
|
+
return (0, $58246871e4652552$export$60dfd74aa96791bd)(this);
|
|
73
80
|
}
|
|
74
81
|
/** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */ compare(b) {
|
|
75
|
-
return (0, $
|
|
76
|
-
}
|
|
77
|
-
constructor(...args){
|
|
78
|
-
(0, $aksy1$_)(this, $35ea8db9cb2ccb90$var$_type, {
|
|
79
|
-
writable: true,
|
|
80
|
-
value: void 0
|
|
81
|
-
});
|
|
82
|
-
let [calendar, era, year, month, day] = $35ea8db9cb2ccb90$var$shiftArgs(args);
|
|
83
|
-
this.calendar = calendar;
|
|
84
|
-
this.era = era;
|
|
85
|
-
this.year = year;
|
|
86
|
-
this.month = month;
|
|
87
|
-
this.day = day;
|
|
88
|
-
(0, $735220c2d4774dd3$export$c4e2ecac49351ef2)(this);
|
|
82
|
+
return (0, $ad063034c8620db8$export$68781ddf31c0090f)(this, b);
|
|
89
83
|
}
|
|
90
84
|
}
|
|
91
|
-
|
|
92
|
-
//
|
|
93
|
-
|
|
94
|
-
|
|
85
|
+
class $2aaf608024c21ca1$export$680ea196effce5f {
|
|
86
|
+
// This prevents TypeScript from allowing other types with the same fields to match.
|
|
87
|
+
// @ts-ignore
|
|
88
|
+
#type;
|
|
89
|
+
constructor(hour = 0, minute = 0, second = 0, millisecond = 0){
|
|
90
|
+
this.hour = hour;
|
|
91
|
+
this.minute = minute;
|
|
92
|
+
this.second = second;
|
|
93
|
+
this.millisecond = millisecond;
|
|
94
|
+
(0, $435a2ceaa8778ed8$export$7555de1e070510cb)(this);
|
|
95
|
+
}
|
|
95
96
|
/** Returns a copy of this time. */ copy() {
|
|
96
|
-
return new $
|
|
97
|
+
return new $2aaf608024c21ca1$export$680ea196effce5f(this.hour, this.minute, this.second, this.millisecond);
|
|
97
98
|
}
|
|
98
99
|
/** Returns a new `Time` with the given duration added to it. */ add(duration) {
|
|
99
|
-
return (0, $
|
|
100
|
+
return (0, $435a2ceaa8778ed8$export$7ed87b6bc2506470)(this, duration);
|
|
100
101
|
}
|
|
101
102
|
/** Returns a new `Time` with the given duration subtracted from it. */ subtract(duration) {
|
|
102
|
-
return (0, $
|
|
103
|
+
return (0, $435a2ceaa8778ed8$export$fe34d3a381cd7501)(this, duration);
|
|
103
104
|
}
|
|
104
105
|
/** Returns a new `Time` with the given fields set to the provided values. Other fields will be constrained accordingly. */ set(fields) {
|
|
105
|
-
return (0, $
|
|
106
|
+
return (0, $435a2ceaa8778ed8$export$e5d5e1c1822b6e56)(this, fields);
|
|
106
107
|
}
|
|
107
108
|
/**
|
|
108
109
|
* Returns a new `Time` with the given field adjusted by a specified amount.
|
|
109
110
|
* When the resulting value reaches the limits of the field, it wraps around.
|
|
110
111
|
*/ cycle(field, amount, options) {
|
|
111
|
-
return (0, $
|
|
112
|
+
return (0, $435a2ceaa8778ed8$export$dd02b3e0007dfe28)(this, field, amount, options);
|
|
112
113
|
}
|
|
113
114
|
/** Converts the time to an ISO 8601 formatted string. */ toString() {
|
|
114
|
-
return (0, $
|
|
115
|
+
return (0, $58246871e4652552$export$f59dee82248f5ad4)(this);
|
|
115
116
|
}
|
|
116
117
|
/** Compares this time with another. A negative result indicates that this time is before the given one, and a positive time indicates that it is after. */ compare(b) {
|
|
117
|
-
return (0, $
|
|
118
|
-
}
|
|
119
|
-
constructor(hour = 0, minute = 0, second = 0, millisecond = 0){
|
|
120
|
-
(0, $aksy1$_)(this, $35ea8db9cb2ccb90$var$_type1, {
|
|
121
|
-
writable: true,
|
|
122
|
-
value: void 0
|
|
123
|
-
});
|
|
124
|
-
this.hour = hour;
|
|
125
|
-
this.minute = minute;
|
|
126
|
-
this.second = second;
|
|
127
|
-
this.millisecond = millisecond;
|
|
128
|
-
(0, $735220c2d4774dd3$export$7555de1e070510cb)(this);
|
|
118
|
+
return (0, $ad063034c8620db8$export$c19a80a9721b80f6)(this, b);
|
|
129
119
|
}
|
|
130
120
|
}
|
|
131
|
-
|
|
132
|
-
//
|
|
133
|
-
|
|
134
|
-
|
|
121
|
+
class $2aaf608024c21ca1$export$ca871e8dbb80966f {
|
|
122
|
+
// This prevents TypeScript from allowing other types with the same fields to match.
|
|
123
|
+
// @ts-ignore
|
|
124
|
+
#type;
|
|
125
|
+
constructor(...args){
|
|
126
|
+
let [calendar, era, year, month, day] = $2aaf608024c21ca1$var$shiftArgs(args);
|
|
127
|
+
this.calendar = calendar;
|
|
128
|
+
this.era = era;
|
|
129
|
+
this.year = year;
|
|
130
|
+
this.month = month;
|
|
131
|
+
this.day = day;
|
|
132
|
+
this.hour = args.shift() || 0;
|
|
133
|
+
this.minute = args.shift() || 0;
|
|
134
|
+
this.second = args.shift() || 0;
|
|
135
|
+
this.millisecond = args.shift() || 0;
|
|
136
|
+
(0, $435a2ceaa8778ed8$export$c4e2ecac49351ef2)(this);
|
|
137
|
+
}
|
|
135
138
|
/** Returns a copy of this date. */ copy() {
|
|
136
|
-
if (this.era) return new $
|
|
137
|
-
else return new $
|
|
139
|
+
if (this.era) return new $2aaf608024c21ca1$export$ca871e8dbb80966f(this.calendar, this.era, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond);
|
|
140
|
+
else return new $2aaf608024c21ca1$export$ca871e8dbb80966f(this.calendar, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond);
|
|
138
141
|
}
|
|
139
142
|
/** Returns a new `CalendarDateTime` with the given duration added to it. */ add(duration) {
|
|
140
|
-
return (0, $
|
|
143
|
+
return (0, $435a2ceaa8778ed8$export$e16d8520af44a096)(this, duration);
|
|
141
144
|
}
|
|
142
145
|
/** Returns a new `CalendarDateTime` with the given duration subtracted from it. */ subtract(duration) {
|
|
143
|
-
return (0, $
|
|
146
|
+
return (0, $435a2ceaa8778ed8$export$4e2d2ead65e5f7e3)(this, duration);
|
|
144
147
|
}
|
|
145
148
|
/** Returns a new `CalendarDateTime` with the given fields set to the provided values. Other fields will be constrained accordingly. */ set(fields) {
|
|
146
|
-
return (0, $
|
|
149
|
+
return (0, $435a2ceaa8778ed8$export$adaa4cf7ef1b65be)((0, $435a2ceaa8778ed8$export$e5d5e1c1822b6e56)(this, fields), fields);
|
|
147
150
|
}
|
|
148
151
|
/**
|
|
149
152
|
* Returns a new `CalendarDateTime` with the given field adjusted by a specified amount.
|
|
@@ -154,99 +157,78 @@ class $35ea8db9cb2ccb90$export$ca871e8dbb80966f {
|
|
|
154
157
|
case 'year':
|
|
155
158
|
case 'month':
|
|
156
159
|
case 'day':
|
|
157
|
-
return (0, $
|
|
160
|
+
return (0, $435a2ceaa8778ed8$export$d52ced6badfb9a4c)(this, field, amount, options);
|
|
158
161
|
default:
|
|
159
|
-
return (0, $
|
|
162
|
+
return (0, $435a2ceaa8778ed8$export$dd02b3e0007dfe28)(this, field, amount, options);
|
|
160
163
|
}
|
|
161
164
|
}
|
|
162
165
|
/** Converts the date to a native JavaScript Date object in the given time zone. */ toDate(timeZone, disambiguation) {
|
|
163
|
-
return (0, $
|
|
166
|
+
return (0, $d07e34cce18680fd$export$e67a095c620b86fe)(this, timeZone, disambiguation);
|
|
164
167
|
}
|
|
165
168
|
/** Converts the date to an ISO 8601 formatted string. */ toString() {
|
|
166
|
-
return (0, $
|
|
169
|
+
return (0, $58246871e4652552$export$4223de14708adc63)(this);
|
|
167
170
|
}
|
|
168
171
|
/** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */ compare(b) {
|
|
169
|
-
let res = (0, $
|
|
170
|
-
if (res === 0) return (0, $
|
|
172
|
+
let res = (0, $ad063034c8620db8$export$68781ddf31c0090f)(this, b);
|
|
173
|
+
if (res === 0) return (0, $ad063034c8620db8$export$c19a80a9721b80f6)(this, (0, $d07e34cce18680fd$export$b21e0b124e224484)(b));
|
|
171
174
|
return res;
|
|
172
175
|
}
|
|
176
|
+
}
|
|
177
|
+
class $2aaf608024c21ca1$export$d3b7288e7994edea {
|
|
178
|
+
// This prevents TypeScript from allowing other types with the same fields to match.
|
|
179
|
+
// @ts-ignore
|
|
180
|
+
#type;
|
|
173
181
|
constructor(...args){
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
});
|
|
178
|
-
let [calendar, era, year, month, day] = $35ea8db9cb2ccb90$var$shiftArgs(args);
|
|
182
|
+
let [calendar, era, year, month, day] = $2aaf608024c21ca1$var$shiftArgs(args);
|
|
183
|
+
let timeZone = args.shift();
|
|
184
|
+
let offset = args.shift();
|
|
179
185
|
this.calendar = calendar;
|
|
180
186
|
this.era = era;
|
|
181
187
|
this.year = year;
|
|
182
188
|
this.month = month;
|
|
183
189
|
this.day = day;
|
|
190
|
+
this.timeZone = timeZone;
|
|
191
|
+
this.offset = offset;
|
|
184
192
|
this.hour = args.shift() || 0;
|
|
185
193
|
this.minute = args.shift() || 0;
|
|
186
194
|
this.second = args.shift() || 0;
|
|
187
195
|
this.millisecond = args.shift() || 0;
|
|
188
|
-
(0, $
|
|
196
|
+
(0, $435a2ceaa8778ed8$export$c4e2ecac49351ef2)(this);
|
|
189
197
|
}
|
|
190
|
-
}
|
|
191
|
-
var // This prevents TypeScript from allowing other types with the same fields to match.
|
|
192
|
-
// @ts-ignore
|
|
193
|
-
$35ea8db9cb2ccb90$var$_type3 = /*#__PURE__*/ new WeakMap();
|
|
194
|
-
class $35ea8db9cb2ccb90$export$d3b7288e7994edea {
|
|
195
198
|
/** Returns a copy of this date. */ copy() {
|
|
196
|
-
if (this.era) return new $
|
|
197
|
-
else return new $
|
|
199
|
+
if (this.era) return new $2aaf608024c21ca1$export$d3b7288e7994edea(this.calendar, this.era, this.year, this.month, this.day, this.timeZone, this.offset, this.hour, this.minute, this.second, this.millisecond);
|
|
200
|
+
else return new $2aaf608024c21ca1$export$d3b7288e7994edea(this.calendar, this.year, this.month, this.day, this.timeZone, this.offset, this.hour, this.minute, this.second, this.millisecond);
|
|
198
201
|
}
|
|
199
202
|
/** Returns a new `ZonedDateTime` with the given duration added to it. */ add(duration) {
|
|
200
|
-
return (0, $
|
|
203
|
+
return (0, $435a2ceaa8778ed8$export$96b1d28349274637)(this, duration);
|
|
201
204
|
}
|
|
202
205
|
/** Returns a new `ZonedDateTime` with the given duration subtracted from it. */ subtract(duration) {
|
|
203
|
-
return (0, $
|
|
206
|
+
return (0, $435a2ceaa8778ed8$export$6814caac34ca03c7)(this, duration);
|
|
204
207
|
}
|
|
205
208
|
/** Returns a new `ZonedDateTime` with the given fields set to the provided values. Other fields will be constrained accordingly. */ set(fields, disambiguation) {
|
|
206
|
-
return (0, $
|
|
209
|
+
return (0, $435a2ceaa8778ed8$export$31b5430eb18be4f8)(this, fields, disambiguation);
|
|
207
210
|
}
|
|
208
211
|
/**
|
|
209
212
|
* Returns a new `ZonedDateTime` with the given field adjusted by a specified amount.
|
|
210
213
|
* When the resulting value reaches the limits of the field, it wraps around.
|
|
211
214
|
*/ cycle(field, amount, options) {
|
|
212
|
-
return (0, $
|
|
215
|
+
return (0, $435a2ceaa8778ed8$export$9a297d111fc86b79)(this, field, amount, options);
|
|
213
216
|
}
|
|
214
217
|
/** Converts the date to a native JavaScript Date object. */ toDate() {
|
|
215
|
-
return (0, $
|
|
218
|
+
return (0, $d07e34cce18680fd$export$83aac07b4c37b25)(this);
|
|
216
219
|
}
|
|
217
220
|
/** Converts the date to an ISO 8601 formatted string, including the UTC offset and time zone identifier. */ toString() {
|
|
218
|
-
return (0, $
|
|
221
|
+
return (0, $58246871e4652552$export$bf79f1ebf4b18792)(this);
|
|
219
222
|
}
|
|
220
223
|
/** Converts the date to an ISO 8601 formatted string in UTC. */ toAbsoluteString() {
|
|
221
224
|
return this.toDate().toISOString();
|
|
222
225
|
}
|
|
223
226
|
/** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */ compare(b) {
|
|
224
227
|
// TODO: Is this a bad idea??
|
|
225
|
-
return this.toDate().getTime() - (0, $
|
|
226
|
-
}
|
|
227
|
-
constructor(...args){
|
|
228
|
-
(0, $aksy1$_)(this, $35ea8db9cb2ccb90$var$_type3, {
|
|
229
|
-
writable: true,
|
|
230
|
-
value: void 0
|
|
231
|
-
});
|
|
232
|
-
let [calendar, era, year, month, day] = $35ea8db9cb2ccb90$var$shiftArgs(args);
|
|
233
|
-
let timeZone = args.shift();
|
|
234
|
-
let offset = args.shift();
|
|
235
|
-
this.calendar = calendar;
|
|
236
|
-
this.era = era;
|
|
237
|
-
this.year = year;
|
|
238
|
-
this.month = month;
|
|
239
|
-
this.day = day;
|
|
240
|
-
this.timeZone = timeZone;
|
|
241
|
-
this.offset = offset;
|
|
242
|
-
this.hour = args.shift() || 0;
|
|
243
|
-
this.minute = args.shift() || 0;
|
|
244
|
-
this.second = args.shift() || 0;
|
|
245
|
-
this.millisecond = args.shift() || 0;
|
|
246
|
-
(0, $735220c2d4774dd3$export$c4e2ecac49351ef2)(this);
|
|
228
|
+
return this.toDate().getTime() - (0, $d07e34cce18680fd$export$84c95a83c799e074)(b, this.timeZone).toDate().getTime();
|
|
247
229
|
}
|
|
248
230
|
}
|
|
249
231
|
|
|
250
232
|
|
|
251
|
-
export {$
|
|
252
|
-
//# sourceMappingURL=CalendarDate.
|
|
233
|
+
export {$2aaf608024c21ca1$export$99faa760c7908e4f as CalendarDate, $2aaf608024c21ca1$export$680ea196effce5f as Time, $2aaf608024c21ca1$export$ca871e8dbb80966f as CalendarDateTime, $2aaf608024c21ca1$export$d3b7288e7994edea as ZonedDateTime};
|
|
234
|
+
//# sourceMappingURL=CalendarDate.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAWD,SAAS,gCAAU,IAAW;IAC5B,IAAI,WAAqB,OAAO,IAAI,CAAC,EAAE,KAAK,WACxC,KAAK,KAAK,KACV,IAAI,CAAA,GAAA,yCAAgB;IAExB,IAAI;IACJ,IAAI,OAAO,IAAI,CAAC,EAAE,KAAK,UACrB,MAAM,KAAK,KAAK;SACX;QACL,IAAI,OAAO,SAAS,OAAO;QAC3B,MAAM,IAAI,CAAC,KAA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E,IAAI,EAAE;IAC7B;IAEA,kIAAkI,GAClI,IAAI,MAA+B,EAAE,cAA+B,EAAiB;QACnF,OAAO,CAAA,GAAA,yCAAO,EAAE,IAAI,EAAE,QAAQ;IAChC;IAEA;;;GAGC,GACD,MAAM,KAA4B,EAAE,MAAc,EAAE,OAA0B,EAAiB;QAC7F,OAAO,CAAA,GAAA,yCAAS,EAAE,IAAI,EAAE,OAAO,QAAQ;IACzC;IAEA,0DAA0D,GAC1D,SAAe;QACb,OAAO,CAAA,GAAA,wCAAU,EAAE,IAAI;IACzB;IAEC,0GAA0G,GAC3G,WAAmB;QACjB,OAAO,CAAA,GAAA,yCAAoB,EAAE,IAAI;IACnC;IAEC,8DAA8D,GAC/D,mBAA2B;QACzB,OAAO,IAAI,CAAC,MAAM,GAAG,WAAW;IAClC;IAEA,yJAAyJ,GACzJ,QAAQ,CAAkD,EAAU;QAClE,6BAA6B;QAC7B,OAAO,IAAI,CAAC,MAAM,GAAG,OAAO,KAAK,CAAA,GAAA,yCAAM,EAAE,GAAG,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAC7E;AACF","sources":["packages/@internationalized/date/src/CalendarDate.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {add, addTime, addZoned, constrain, constrainTime, cycleDate, cycleTime, cycleZoned, set, setTime, setZoned, subtract, subtractTime, subtractZoned} from './manipulation';\nimport {AnyCalendarDate, AnyTime, Calendar, CycleOptions, CycleTimeOptions, DateDuration, DateField, DateFields, DateTimeDuration, Disambiguation, TimeDuration, TimeField, TimeFields} from './types';\nimport {compareDate, compareTime} from './queries';\nimport {dateTimeToString, dateToString, timeToString, zonedDateTimeToString} from './string';\nimport {GregorianCalendar} from './calendars/GregorianCalendar';\nimport {toCalendarDateTime, toDate, toZoned, zonedToDate} from './conversion';\n\nexport type DateValue = CalendarDate | CalendarDateTime | ZonedDateTime;\n\nfunction shiftArgs(args: any[]) {\n let calendar: Calendar = typeof args[0] === 'object'\n ? args.shift()\n : new GregorianCalendar();\n\n let era: string;\n if (typeof args[0] === 'string') {\n era = args.shift();\n } else {\n let eras = calendar.getEras();\n era = eras[eras.length - 1];\n }\n\n let year = args.shift();\n let month = args.shift();\n let day = args.shift();\n\n return [calendar, era, year, month, day];\n}\n\n/** A CalendarDate represents a date without any time components in a specific calendar system. */\nexport class CalendarDate {\n // This prevents TypeScript from allowing other types with the same fields to match.\n // i.e. a ZonedDateTime should not be be passable to a parameter that expects CalendarDate.\n // If that behavior is desired, use the AnyCalendarDate interface instead.\n // @ts-ignore\n #type;\n /** The calendar system associated with this date, e.g. Gregorian. */\n public readonly calendar: Calendar;\n /** The calendar era for this date, e.g. \"BC\" or \"AD\". */\n public readonly era: string;\n /** The year of this date within the era. */\n public readonly year: number;\n /**\n * The month number within the year. Note that some calendar systems such as Hebrew\n * may have a variable number of months per year. Therefore, month numbers may not\n * always correspond to the same month names in different years.\n */\n public readonly month: number;\n /** The day number within the month. */\n public readonly day: number;\n\n constructor(year: number, month: number, day: number);\n constructor(era: string, year: number, month: number, day: number);\n constructor(calendar: Calendar, year: number, month: number, day: number);\n constructor(calendar: Calendar, era: string, year: number, month: number, day: number);\n constructor(...args: any[]) {\n let [calendar, era, year, month, day] = shiftArgs(args);\n this.calendar = calendar;\n this.era = era;\n this.year = year;\n this.month = month;\n this.day = day;\n\n constrain(this);\n }\n\n /** Returns a copy of this date. */\n copy(): CalendarDate {\n if (this.era) {\n return new CalendarDate(this.calendar, this.era, this.year, this.month, this.day);\n } else {\n return new CalendarDate(this.calendar, this.year, this.month, this.day);\n }\n }\n\n /** Returns a new `CalendarDate` with the given duration added to it. */\n add(duration: DateDuration): CalendarDate {\n return add(this, duration);\n }\n\n /** Returns a new `CalendarDate` with the given duration subtracted from it. */\n subtract(duration: DateDuration): CalendarDate {\n return subtract(this, duration);\n }\n\n /** Returns a new `CalendarDate` with the given fields set to the provided values. Other fields will be constrained accordingly. */\n set(fields: DateFields): CalendarDate {\n return set(this, fields);\n }\n\n /**\n * Returns a new `CalendarDate` with the given field adjusted by a specified amount.\n * When the resulting value reaches the limits of the field, it wraps around.\n */\n cycle(field: DateField, amount: number, options?: CycleOptions): CalendarDate {\n return cycleDate(this, field, amount, options);\n }\n\n /** Converts the date to a native JavaScript Date object, with the time set to midnight in the given time zone. */\n toDate(timeZone: string): Date {\n return toDate(this, timeZone);\n }\n\n /** Converts the date to an ISO 8601 formatted string. */\n toString(): string {\n return dateToString(this);\n }\n\n /** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */\n compare(b: AnyCalendarDate): number {\n return compareDate(this, b);\n }\n}\n\n/** A Time represents a clock time without any date components. */\nexport class Time {\n // This prevents TypeScript from allowing other types with the same fields to match.\n // @ts-ignore\n #type;\n /** The hour, numbered from 0 to 23. */\n public readonly hour: number;\n /** The minute in the hour. */\n public readonly minute: number;\n /** The second in the minute. */\n public readonly second: number;\n /** The millisecond in the second. */\n public readonly millisecond: number;\n\n constructor(\n hour: number = 0,\n minute: number = 0,\n second: number = 0,\n millisecond: number = 0\n ) {\n this.hour = hour;\n this.minute = minute;\n this.second = second;\n this.millisecond = millisecond;\n constrainTime(this);\n }\n\n /** Returns a copy of this time. */\n copy(): Time {\n return new Time(this.hour, this.minute, this.second, this.millisecond);\n }\n\n /** Returns a new `Time` with the given duration added to it. */\n add(duration: TimeDuration): Time {\n return addTime(this, duration);\n }\n\n /** Returns a new `Time` with the given duration subtracted from it. */\n subtract(duration: TimeDuration): Time {\n return subtractTime(this, duration);\n }\n\n /** Returns a new `Time` with the given fields set to the provided values. Other fields will be constrained accordingly. */\n set(fields: TimeFields): Time {\n return setTime(this, fields);\n }\n\n /**\n * Returns a new `Time` with the given field adjusted by a specified amount.\n * When the resulting value reaches the limits of the field, it wraps around.\n */\n cycle(field: TimeField, amount: number, options?: CycleTimeOptions): Time {\n return cycleTime(this, field, amount, options);\n }\n\n /** Converts the time to an ISO 8601 formatted string. */\n toString(): string {\n return timeToString(this);\n }\n\n /** Compares this time with another. A negative result indicates that this time is before the given one, and a positive time indicates that it is after. */\n compare(b: AnyTime): number {\n return compareTime(this, b);\n }\n}\n\n/** A CalendarDateTime represents a date and time without a time zone, in a specific calendar system. */\nexport class CalendarDateTime {\n // This prevents TypeScript from allowing other types with the same fields to match.\n // @ts-ignore\n #type;\n /** The calendar system associated with this date, e.g. Gregorian. */\n public readonly calendar: Calendar;\n /** The calendar era for this date, e.g. \"BC\" or \"AD\". */\n public readonly era: string;\n /** The year of this date within the era. */\n public readonly year: number;\n /**\n * The month number within the year. Note that some calendar systems such as Hebrew\n * may have a variable number of months per year. Therefore, month numbers may not\n * always correspond to the same month names in different years.\n */\n public readonly month: number;\n /** The day number within the month. */\n public readonly day: number;\n /** The hour in the day, numbered from 0 to 23. */\n public readonly hour: number;\n /** The minute in the hour. */\n public readonly minute: number;\n /** The second in the minute. */\n public readonly second: number;\n /** The millisecond in the second. */\n public readonly millisecond: number;\n\n constructor(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number);\n constructor(era: string, year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number);\n constructor(calendar: Calendar, year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number);\n constructor(calendar: Calendar, era: string, year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number);\n constructor(...args: any[]) {\n let [calendar, era, year, month, day] = shiftArgs(args);\n this.calendar = calendar;\n this.era = era;\n this.year = year;\n this.month = month;\n this.day = day;\n this.hour = args.shift() || 0;\n this.minute = args.shift() || 0;\n this.second = args.shift() || 0;\n this.millisecond = args.shift() || 0;\n\n constrain(this);\n }\n\n /** Returns a copy of this date. */\n copy(): CalendarDateTime {\n if (this.era) {\n return new CalendarDateTime(this.calendar, this.era, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond);\n } else {\n return new CalendarDateTime(this.calendar, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond);\n }\n }\n\n /** Returns a new `CalendarDateTime` with the given duration added to it. */\n add(duration: DateTimeDuration): CalendarDateTime {\n return add(this, duration);\n }\n\n /** Returns a new `CalendarDateTime` with the given duration subtracted from it. */\n subtract(duration: DateTimeDuration): CalendarDateTime {\n return subtract(this, duration);\n }\n\n /** Returns a new `CalendarDateTime` with the given fields set to the provided values. Other fields will be constrained accordingly. */\n set(fields: DateFields & TimeFields): CalendarDateTime {\n return set(setTime(this, fields), fields);\n }\n\n /**\n * Returns a new `CalendarDateTime` with the given field adjusted by a specified amount.\n * When the resulting value reaches the limits of the field, it wraps around.\n */\n cycle(field: DateField | TimeField, amount: number, options?: CycleTimeOptions): CalendarDateTime {\n switch (field) {\n case 'era':\n case 'year':\n case 'month':\n case 'day':\n return cycleDate(this, field, amount, options);\n default:\n return cycleTime(this, field, amount, options);\n }\n }\n\n /** Converts the date to a native JavaScript Date object in the given time zone. */\n toDate(timeZone: string, disambiguation?: Disambiguation): Date {\n return toDate(this, timeZone, disambiguation);\n }\n\n /** Converts the date to an ISO 8601 formatted string. */\n toString(): string {\n return dateTimeToString(this);\n }\n\n /** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */\n compare(b: CalendarDate | CalendarDateTime | ZonedDateTime): number {\n let res = compareDate(this, b);\n if (res === 0) {\n return compareTime(this, toCalendarDateTime(b));\n }\n\n return res;\n }\n}\n\n/** A ZonedDateTime represents a date and time in a specific time zone and calendar system. */\nexport class ZonedDateTime {\n // This prevents TypeScript from allowing other types with the same fields to match.\n // @ts-ignore\n #type;\n /** The calendar system associated with this date, e.g. Gregorian. */\n public readonly calendar: Calendar;\n /** The calendar era for this date, e.g. \"BC\" or \"AD\". */\n public readonly era: string;\n /** The year of this date within the era. */\n public readonly year: number;\n /**\n * The month number within the year. Note that some calendar systems such as Hebrew\n * may have a variable number of months per year. Therefore, month numbers may not\n * always correspond to the same month names in different years.\n */\n public readonly month: number;\n /** The day number within the month. */\n public readonly day: number;\n /** The hour in the day, numbered from 0 to 23. */\n public readonly hour: number;\n /** The minute in the hour. */\n public readonly minute: number;\n /** The second in the minute. */\n public readonly second: number;\n /** The millisecond in the second. */\n public readonly millisecond: number;\n /** The IANA time zone identifier that this date and time is represented in. */\n public readonly timeZone: string;\n /** The UTC offset for this time, in milliseconds. */\n public readonly offset: number;\n\n constructor(year: number, month: number, day: number, timeZone: string, offset: number, hour?: number, minute?: number, second?: number, millisecond?: number);\n constructor(era: string, year: number, month: number, day: number, timeZone: string, offset: number, hour?: number, minute?: number, second?: number, millisecond?: number);\n constructor(calendar: Calendar, year: number, month: number, day: number, timeZone: string, offset: number, hour?: number, minute?: number, second?: number, millisecond?: number);\n constructor(calendar: Calendar, era: string, year: number, month: number, day: number, timeZone: string, offset: number, hour?: number, minute?: number, second?: number, millisecond?: number);\n constructor(...args: any[]) {\n let [calendar, era, year, month, day] = shiftArgs(args);\n let timeZone = args.shift();\n let offset = args.shift();\n this.calendar = calendar;\n this.era = era;\n this.year = year;\n this.month = month;\n this.day = day;\n this.timeZone = timeZone;\n this.offset = offset;\n this.hour = args.shift() || 0;\n this.minute = args.shift() || 0;\n this.second = args.shift() || 0;\n this.millisecond = args.shift() || 0;\n\n constrain(this);\n }\n\n /** Returns a copy of this date. */\n copy(): ZonedDateTime {\n if (this.era) {\n return new ZonedDateTime(this.calendar, this.era, this.year, this.month, this.day, this.timeZone, this.offset, this.hour, this.minute, this.second, this.millisecond);\n } else {\n return new ZonedDateTime(this.calendar, this.year, this.month, this.day, this.timeZone, this.offset, this.hour, this.minute, this.second, this.millisecond);\n }\n }\n\n /** Returns a new `ZonedDateTime` with the given duration added to it. */\n add(duration: DateTimeDuration): ZonedDateTime {\n return addZoned(this, duration);\n }\n\n /** Returns a new `ZonedDateTime` with the given duration subtracted from it. */\n subtract(duration: DateTimeDuration): ZonedDateTime {\n return subtractZoned(this, duration);\n }\n\n /** Returns a new `ZonedDateTime` with the given fields set to the provided values. Other fields will be constrained accordingly. */\n set(fields: DateFields & TimeFields, disambiguation?: Disambiguation): ZonedDateTime {\n return setZoned(this, fields, disambiguation);\n }\n\n /**\n * Returns a new `ZonedDateTime` with the given field adjusted by a specified amount.\n * When the resulting value reaches the limits of the field, it wraps around.\n */\n cycle(field: DateField | TimeField, amount: number, options?: CycleTimeOptions): ZonedDateTime {\n return cycleZoned(this, field, amount, options);\n }\n\n /** Converts the date to a native JavaScript Date object. */\n toDate(): Date {\n return zonedToDate(this);\n }\n\n /** Converts the date to an ISO 8601 formatted string, including the UTC offset and time zone identifier. */\n toString(): string {\n return zonedDateTimeToString(this);\n }\n\n /** Converts the date to an ISO 8601 formatted string in UTC. */\n toAbsoluteString(): string {\n return this.toDate().toISOString();\n }\n\n /** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */\n compare(b: CalendarDate | CalendarDateTime | ZonedDateTime): number {\n // TODO: Is this a bad idea??\n return this.toDate().getTime() - toZoned(b, this.timeZone).toDate().getTime();\n }\n}\n"],"names":[],"version":3,"file":"CalendarDate.mjs.map"}
|
|
@@ -3,7 +3,7 @@ function $parcel$export(e, n, v, s) {
|
|
|
3
3
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
$parcel$export(module.exports, "DateFormatter", ()
|
|
6
|
+
$parcel$export(module.exports, "DateFormatter", function () { return $10afcf45c4831ff7$export$ad991b66133851cf; });
|
|
7
7
|
/*
|
|
8
8
|
* Copyright 2020 Adobe. All rights reserved.
|
|
9
9
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -14,8 +14,12 @@ $parcel$export(module.exports, "DateFormatter", () => $8f23a04ae90a588b$export$a
|
|
|
14
14
|
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
15
15
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
16
16
|
* governing permissions and limitations under the License.
|
|
17
|
-
*/ let $
|
|
18
|
-
class $
|
|
17
|
+
*/ let $10afcf45c4831ff7$var$formatterCache = new Map();
|
|
18
|
+
class $10afcf45c4831ff7$export$ad991b66133851cf {
|
|
19
|
+
constructor(locale, options = {}){
|
|
20
|
+
this.formatter = $10afcf45c4831ff7$var$getCachedDateFormatter(locale, options);
|
|
21
|
+
this.options = options;
|
|
22
|
+
}
|
|
19
23
|
/** Formats a date as a string according to the locale and format options passed to the constructor. */ format(value) {
|
|
20
24
|
return this.formatter.format(value);
|
|
21
25
|
}
|
|
@@ -55,8 +59,8 @@ class $8f23a04ae90a588b$export$ad991b66133851cf {
|
|
|
55
59
|
}
|
|
56
60
|
/** Returns the resolved formatting options based on the values passed to the constructor. */ resolvedOptions() {
|
|
57
61
|
let resolvedOptions = this.formatter.resolvedOptions();
|
|
58
|
-
if ($
|
|
59
|
-
if (!this.resolvedHourCycle) this.resolvedHourCycle = $
|
|
62
|
+
if ($10afcf45c4831ff7$var$hasBuggyResolvedHourCycle()) {
|
|
63
|
+
if (!this.resolvedHourCycle) this.resolvedHourCycle = $10afcf45c4831ff7$var$getResolvedHourCycle(resolvedOptions.locale, this.options);
|
|
60
64
|
resolvedOptions.hourCycle = this.resolvedHourCycle;
|
|
61
65
|
resolvedOptions.hour12 = this.resolvedHourCycle === 'h11' || this.resolvedHourCycle === 'h12';
|
|
62
66
|
}
|
|
@@ -65,10 +69,6 @@ class $8f23a04ae90a588b$export$ad991b66133851cf {
|
|
|
65
69
|
if (resolvedOptions.calendar === 'ethiopic-amete-alem') resolvedOptions.calendar = 'ethioaa';
|
|
66
70
|
return resolvedOptions;
|
|
67
71
|
}
|
|
68
|
-
constructor(locale, options = {}){
|
|
69
|
-
this.formatter = $8f23a04ae90a588b$var$getCachedDateFormatter(locale, options);
|
|
70
|
-
this.options = options;
|
|
71
|
-
}
|
|
72
72
|
}
|
|
73
73
|
// There are multiple bugs involving the hour12 and hourCycle options in various browser engines.
|
|
74
74
|
// - Chrome [1] (and the ECMA 402 spec [2]) resolve hour12: false in English and other locales to h24 (24:00 - 23:59)
|
|
@@ -80,7 +80,7 @@ class $8f23a04ae90a588b$export$ad991b66133851cf {
|
|
|
80
80
|
// [2] https://github.com/tc39/ecma402/issues/402
|
|
81
81
|
// [3] https://bugs.webkit.org/show_bug.cgi?id=229313
|
|
82
82
|
// https://github.com/unicode-org/cldr/blob/018b55eff7ceb389c7e3fc44e2f657eae3b10b38/common/supplemental/supplementalData.xml#L4774-L4802
|
|
83
|
-
const $
|
|
83
|
+
const $10afcf45c4831ff7$var$hour12Preferences = {
|
|
84
84
|
true: {
|
|
85
85
|
// Only Japanese uses the h11 style for 12 hour time. All others use h12.
|
|
86
86
|
ja: 'h11'
|
|
@@ -88,47 +88,47 @@ const $8f23a04ae90a588b$var$hour12Preferences = {
|
|
|
88
88
|
false: {
|
|
89
89
|
}
|
|
90
90
|
};
|
|
91
|
-
function $
|
|
91
|
+
function $10afcf45c4831ff7$var$getCachedDateFormatter(locale, options = {}) {
|
|
92
92
|
// Work around buggy hour12 behavior in Chrome / ECMA 402 spec by using hourCycle instead.
|
|
93
93
|
// Only apply the workaround if the issue is detected, because the hourCycle option is buggy in Safari.
|
|
94
|
-
if (typeof options.hour12 === 'boolean' && $
|
|
94
|
+
if (typeof options.hour12 === 'boolean' && $10afcf45c4831ff7$var$hasBuggyHour12Behavior()) {
|
|
95
95
|
options = {
|
|
96
96
|
...options
|
|
97
97
|
};
|
|
98
|
-
let pref = $
|
|
98
|
+
let pref = $10afcf45c4831ff7$var$hour12Preferences[String(options.hour12)][locale.split('-')[0]];
|
|
99
99
|
let defaultHourCycle = options.hour12 ? 'h12' : 'h23';
|
|
100
|
-
options.hourCycle = pref
|
|
100
|
+
options.hourCycle = pref ?? defaultHourCycle;
|
|
101
101
|
delete options.hour12;
|
|
102
102
|
}
|
|
103
103
|
let cacheKey = locale + (options ? Object.entries(options).sort((a, b)=>a[0] < b[0] ? -1 : 1).join() : '');
|
|
104
|
-
if ($
|
|
104
|
+
if ($10afcf45c4831ff7$var$formatterCache.has(cacheKey)) return $10afcf45c4831ff7$var$formatterCache.get(cacheKey);
|
|
105
105
|
let numberFormatter = new Intl.DateTimeFormat(locale, options);
|
|
106
|
-
$
|
|
106
|
+
$10afcf45c4831ff7$var$formatterCache.set(cacheKey, numberFormatter);
|
|
107
107
|
return numberFormatter;
|
|
108
108
|
}
|
|
109
|
-
let $
|
|
110
|
-
function $
|
|
111
|
-
if ($
|
|
109
|
+
let $10afcf45c4831ff7$var$_hasBuggyHour12Behavior = null;
|
|
110
|
+
function $10afcf45c4831ff7$var$hasBuggyHour12Behavior() {
|
|
111
|
+
if ($10afcf45c4831ff7$var$_hasBuggyHour12Behavior == null) $10afcf45c4831ff7$var$_hasBuggyHour12Behavior = new Intl.DateTimeFormat('en-US', {
|
|
112
112
|
hour: 'numeric',
|
|
113
113
|
hour12: false
|
|
114
114
|
}).format(new Date(2020, 2, 3, 0)) === '24';
|
|
115
|
-
return $
|
|
115
|
+
return $10afcf45c4831ff7$var$_hasBuggyHour12Behavior;
|
|
116
116
|
}
|
|
117
|
-
let $
|
|
118
|
-
function $
|
|
119
|
-
if ($
|
|
117
|
+
let $10afcf45c4831ff7$var$_hasBuggyResolvedHourCycle = null;
|
|
118
|
+
function $10afcf45c4831ff7$var$hasBuggyResolvedHourCycle() {
|
|
119
|
+
if ($10afcf45c4831ff7$var$_hasBuggyResolvedHourCycle == null) $10afcf45c4831ff7$var$_hasBuggyResolvedHourCycle = new Intl.DateTimeFormat('fr', {
|
|
120
120
|
hour: 'numeric',
|
|
121
121
|
hour12: false
|
|
122
122
|
}).resolvedOptions().hourCycle === 'h12';
|
|
123
|
-
return $
|
|
123
|
+
return $10afcf45c4831ff7$var$_hasBuggyResolvedHourCycle;
|
|
124
124
|
}
|
|
125
|
-
function $
|
|
125
|
+
function $10afcf45c4831ff7$var$getResolvedHourCycle(locale, options) {
|
|
126
126
|
if (!options.timeStyle && !options.hour) return undefined;
|
|
127
127
|
// Work around buggy results in resolved hourCycle and hour12 options in WebKit.
|
|
128
128
|
// Format the minimum possible hour and maximum possible hour in a day and parse the results.
|
|
129
129
|
locale = locale.replace(/(-u-)?-nu-[a-zA-Z0-9]+/, '');
|
|
130
130
|
locale += (locale.includes('-u-') ? '' : '-u') + '-nu-latn';
|
|
131
|
-
let formatter = $
|
|
131
|
+
let formatter = $10afcf45c4831ff7$var$getCachedDateFormatter(locale, {
|
|
132
132
|
...options,
|
|
133
133
|
timeZone: undefined // use local timezone
|
|
134
134
|
});
|
|
@@ -142,4 +142,4 @@ function $8f23a04ae90a588b$var$getResolvedHourCycle(locale, options) {
|
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
|
|
145
|
-
//# sourceMappingURL=DateFormatter.
|
|
145
|
+
//# sourceMappingURL=DateFormatter.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;AAAA;;;;;;;;;;CAUC,GAED,IAAI,uCAAiB,IAAI;AAOlB,MAAM;IAKX,YAAY,MAAc,EAAE,UAAsC,CAAC,CAAC,CAAE;QACpE,IAAI,CAAC,SAAS,GAAG,6CAAuB,QAAQ;QAChD,IAAI,CAAC,OAAO,GAAG;IACjB;IAEA,qGAAqG,GACrG,OAAO,KAAW,EAAU;QAC1B,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;IAC/B;IAEA,4FAA4F,GAC5F,cAAc,KAAW,EAA6B;QACpD,OAAO,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC;IACtC;IAEA,sCAAsC,GACtC,YAAY,KAAW,EAAE,GAAS,EAAU;QAC1C,aAAa;QACb,IAAI,OAAO,IAAI,CAAC,SAAS,CAA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QAAQ;IAGzC,OAAO;AACT;AAEA,IAAI,mDAA6C;AACjD,SAAS;IACP,IAAI,oDAA8B,MAChC,mDAA6B,IAAI,KAAK,cAAc,CAAC,MAAM;QACzD,MAAM;QACN,QAAQ;IACV,GAAG,eAAe,GAAG,SAAS,KAAK;IAGrC,OAAO;AACT;AAEA,SAAS,2CAAqB,MAAc,EAAE,OAAmC;IAC/E,IAAI,CAAC,QAAQ,SAAS,IAAI,CAAC,QAAQ,IAAI,EACrC,OAAO;IAGT,gFAAgF;IAChF,6FAA6F;IAC7F,SAAS,OAAO,OAAO,CAAC,0BAA0B;IAClD,UAAU,AAAC,CAAA,OAAO,QAAQ,CAAC,SAAS,KAAK,IAAG,IAAK;IACjD,IAAI,YAAY,6CAAuB,QAAQ;QAC7C,GAAG,OAAO;QACV,UAAU,UAAU,qBAAqB;IAC3C;IAEA,IAAI,MAAM,SAAS,UAAU,aAAa,CAAC,IAAI,KAAK,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,CAAA,IAAK,EAAE,IAAI,KAAK,QAAS,KAAK,EAAE;IACzG,IAAI,MAAM,SAAS,UAAU,aAAa,CAAC,IAAI,KAAK,MAAM,GAAG,GAAG,KAAK,IAAI,CAAC,CAAA,IAAK,EAAE,IAAI,KAAK,QAAS,KAAK,EAAE;IAE1G,IAAI,QAAQ,KAAK,QAAQ,IACvB,OAAO;IAGT,IAAI,QAAQ,MAAM,QAAQ,IACxB,OAAO;IAGT,IAAI,QAAQ,KAAK,QAAQ,IACvB,OAAO;IAGT,IAAI,QAAQ,MAAM,QAAQ,IACxB,OAAO;IAGT,MAAM,IAAI,MAAM;AAClB","sources":["packages/@internationalized/date/src/DateFormatter.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nlet formatterCache = new Map<string, Intl.DateTimeFormat>();\n\ninterface DateRangeFormatPart extends Intl.DateTimeFormatPart {\n source: 'startRange' | 'endRange' | 'shared'\n}\n\n/** A wrapper around Intl.DateTimeFormat that fixes various browser bugs, and polyfills new features. */\nexport class DateFormatter implements Intl.DateTimeFormat {\n private formatter: Intl.DateTimeFormat;\n private options: Intl.DateTimeFormatOptions;\n private resolvedHourCycle: Intl.DateTimeFormatOptions['hourCycle'];\n\n constructor(locale: string, options: Intl.DateTimeFormatOptions = {}) {\n this.formatter = getCachedDateFormatter(locale, options);\n this.options = options;\n }\n\n /** Formats a date as a string according to the locale and format options passed to the constructor. */\n format(value: Date): string {\n return this.formatter.format(value);\n }\n\n /** Formats a date to an array of parts such as separators, numbers, punctuation, and more. */\n formatToParts(value: Date): Intl.DateTimeFormatPart[] {\n return this.formatter.formatToParts(value);\n }\n\n /** Formats a date range as a string. */\n formatRange(start: Date, end: Date): string {\n // @ts-ignore\n if (typeof this.formatter.formatRange === 'function') {\n // @ts-ignore\n return this.formatter.formatRange(start, end);\n }\n\n if (end < start) {\n throw new RangeError('End date must be >= start date');\n }\n\n // Very basic fallback for old browsers.\n return `${this.formatter.format(start)} – ${this.formatter.format(end)}`;\n }\n\n /** Formats a date range as an array of parts. */\n formatRangeToParts(start: Date, end: Date): DateRangeFormatPart[] {\n // @ts-ignore\n if (typeof this.formatter.formatRangeToParts === 'function') {\n // @ts-ignore\n return this.formatter.formatRangeToParts(start, end);\n }\n\n if (end < start) {\n throw new RangeError('End date must be >= start date');\n }\n\n let startParts = this.formatter.formatToParts(start);\n let endParts = this.formatter.formatToParts(end);\n return [\n ...startParts.map(p => ({...p, source: 'startRange'} as DateRangeFormatPart)),\n {type: 'literal', value: ' – ', source: 'shared'},\n ...endParts.map(p => ({...p, source: 'endRange'} as DateRangeFormatPart))\n ];\n }\n\n /** Returns the resolved formatting options based on the values passed to the constructor. */\n resolvedOptions(): Intl.ResolvedDateTimeFormatOptions {\n let resolvedOptions = this.formatter.resolvedOptions();\n if (hasBuggyResolvedHourCycle()) {\n if (!this.resolvedHourCycle) {\n this.resolvedHourCycle = getResolvedHourCycle(resolvedOptions.locale, this.options);\n }\n resolvedOptions.hourCycle = this.resolvedHourCycle;\n resolvedOptions.hour12 = this.resolvedHourCycle === 'h11' || this.resolvedHourCycle === 'h12';\n }\n\n // Safari uses a different name for the Ethiopic (Amete Alem) calendar.\n // https://bugs.webkit.org/show_bug.cgi?id=241564\n if (resolvedOptions.calendar === 'ethiopic-amete-alem') {\n resolvedOptions.calendar = 'ethioaa';\n }\n\n return resolvedOptions;\n }\n}\n\n// There are multiple bugs involving the hour12 and hourCycle options in various browser engines.\n// - Chrome [1] (and the ECMA 402 spec [2]) resolve hour12: false in English and other locales to h24 (24:00 - 23:59)\n// rather than h23 (00:00 - 23:59). Same can happen with hour12: true in French, which Chrome resolves to h11 (00:00 - 11:59)\n// rather than h12 (12:00 - 11:59).\n// - WebKit returns an incorrect hourCycle resolved option in the French locale due to incorrect parsing of 'h' literal\n// in the resolved pattern. It also formats incorrectly when specifying the hourCycle option for the same reason. [3]\n// [1] https://bugs.chromium.org/p/chromium/issues/detail?id=1045791\n// [2] https://github.com/tc39/ecma402/issues/402\n// [3] https://bugs.webkit.org/show_bug.cgi?id=229313\n\n// https://github.com/unicode-org/cldr/blob/018b55eff7ceb389c7e3fc44e2f657eae3b10b38/common/supplemental/supplementalData.xml#L4774-L4802\nconst hour12Preferences = {\n true: {\n // Only Japanese uses the h11 style for 12 hour time. All others use h12.\n ja: 'h11'\n },\n false: {\n // All locales use h23 for 24 hour time. None use h24.\n }\n};\n\nfunction getCachedDateFormatter(locale: string, options: Intl.DateTimeFormatOptions = {}): Intl.DateTimeFormat {\n // Work around buggy hour12 behavior in Chrome / ECMA 402 spec by using hourCycle instead.\n // Only apply the workaround if the issue is detected, because the hourCycle option is buggy in Safari.\n if (typeof options.hour12 === 'boolean' && hasBuggyHour12Behavior()) {\n options = {...options};\n let pref = hour12Preferences[String(options.hour12)][locale.split('-')[0]];\n let defaultHourCycle = options.hour12 ? 'h12' : 'h23';\n options.hourCycle = pref ?? defaultHourCycle;\n delete options.hour12;\n }\n\n let cacheKey = locale + (options ? Object.entries(options).sort((a, b) => a[0] < b[0] ? -1 : 1).join() : '');\n if (formatterCache.has(cacheKey)) {\n return formatterCache.get(cacheKey)!;\n }\n\n let numberFormatter = new Intl.DateTimeFormat(locale, options);\n formatterCache.set(cacheKey, numberFormatter);\n return numberFormatter;\n}\n\nlet _hasBuggyHour12Behavior: boolean | null = null;\nfunction hasBuggyHour12Behavior() {\n if (_hasBuggyHour12Behavior == null) {\n _hasBuggyHour12Behavior = new Intl.DateTimeFormat('en-US', {\n hour: 'numeric',\n hour12: false\n }).format(new Date(2020, 2, 3, 0)) === '24';\n }\n\n return _hasBuggyHour12Behavior;\n}\n\nlet _hasBuggyResolvedHourCycle: boolean | null = null;\nfunction hasBuggyResolvedHourCycle() {\n if (_hasBuggyResolvedHourCycle == null) {\n _hasBuggyResolvedHourCycle = new Intl.DateTimeFormat('fr', {\n hour: 'numeric',\n hour12: false\n }).resolvedOptions().hourCycle === 'h12';\n }\n\n return _hasBuggyResolvedHourCycle;\n}\n\nfunction getResolvedHourCycle(locale: string, options: Intl.DateTimeFormatOptions) {\n if (!options.timeStyle && !options.hour) {\n return undefined;\n }\n\n // Work around buggy results in resolved hourCycle and hour12 options in WebKit.\n // Format the minimum possible hour and maximum possible hour in a day and parse the results.\n locale = locale.replace(/(-u-)?-nu-[a-zA-Z0-9]+/, '');\n locale += (locale.includes('-u-') ? '' : '-u') + '-nu-latn';\n let formatter = getCachedDateFormatter(locale, {\n ...options,\n timeZone: undefined // use local timezone\n });\n\n let min = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 0)).find(p => p.type === 'hour')!.value, 10);\n let max = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 23)).find(p => p.type === 'hour')!.value, 10);\n\n if (min === 0 && max === 23) {\n return 'h23';\n }\n\n if (min === 24 && max === 23) {\n return 'h24';\n }\n\n if (min === 0 && max === 11) {\n return 'h11';\n }\n\n if (min === 12 && max === 11) {\n return 'h12';\n }\n\n throw new Error('Unexpected hour cycle result');\n}\n"],"names":[],"version":3,"file":"DateFormatter.cjs.map"}
|