@internationalized/date 3.0.0-alpha.1 → 3.0.0-alpha.2
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/main.js +2100 -2667
- package/dist/main.js.map +1 -1
- package/dist/module.js +2045 -2444
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/queries.ts +41 -0
package/dist/main.js
CHANGED
|
@@ -1,2736 +1,2193 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _babelRuntimeHelpersClassPrivateFieldLooseKey = $parcel$interopDefault(require("@babel/runtime/helpers/classPrivateFieldLooseKey"));
|
|
4
|
-
|
|
5
|
-
function $parcel$interopDefault(a) {
|
|
6
|
-
return a && a.__esModule ? a.default : a;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
/*
|
|
10
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
11
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
12
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
13
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
-
*
|
|
15
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
16
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
17
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
18
|
-
* governing permissions and limitations under the License.
|
|
19
|
-
*/
|
|
20
|
-
// Data from https://github.com/unicode-cldr/cldr-core/blob/master/supplemental/weekData.json
|
|
21
|
-
// Locales starting on Sunday have been removed for compression.
|
|
22
|
-
const $f9329ef83b780ce5cb2b5b95239f8$export$weekStartData = {
|
|
23
|
-
'001': 1,
|
|
24
|
-
AD: 1,
|
|
25
|
-
AE: 6,
|
|
26
|
-
AF: 6,
|
|
27
|
-
AI: 1,
|
|
28
|
-
AL: 1,
|
|
29
|
-
AM: 1,
|
|
30
|
-
AN: 1,
|
|
31
|
-
AT: 1,
|
|
32
|
-
AX: 1,
|
|
33
|
-
AZ: 1,
|
|
34
|
-
BA: 1,
|
|
35
|
-
BE: 1,
|
|
36
|
-
BG: 1,
|
|
37
|
-
BH: 6,
|
|
38
|
-
BM: 1,
|
|
39
|
-
BN: 1,
|
|
40
|
-
BY: 1,
|
|
41
|
-
CH: 1,
|
|
42
|
-
CL: 1,
|
|
43
|
-
CM: 1,
|
|
44
|
-
CR: 1,
|
|
45
|
-
CY: 1,
|
|
46
|
-
CZ: 1,
|
|
47
|
-
DE: 1,
|
|
48
|
-
DJ: 6,
|
|
49
|
-
DK: 1,
|
|
50
|
-
DZ: 6,
|
|
51
|
-
EC: 1,
|
|
52
|
-
EE: 1,
|
|
53
|
-
EG: 6,
|
|
54
|
-
ES: 1,
|
|
55
|
-
FI: 1,
|
|
56
|
-
FJ: 1,
|
|
57
|
-
FO: 1,
|
|
58
|
-
FR: 1,
|
|
59
|
-
GB: 1,
|
|
60
|
-
GE: 1,
|
|
61
|
-
GF: 1,
|
|
62
|
-
GP: 1,
|
|
63
|
-
GR: 1,
|
|
64
|
-
HR: 1,
|
|
65
|
-
HU: 1,
|
|
66
|
-
IE: 1,
|
|
67
|
-
IQ: 6,
|
|
68
|
-
IR: 6,
|
|
69
|
-
IS: 1,
|
|
70
|
-
IT: 1,
|
|
71
|
-
JO: 6,
|
|
72
|
-
KG: 1,
|
|
73
|
-
KW: 6,
|
|
74
|
-
KZ: 1,
|
|
75
|
-
LB: 1,
|
|
76
|
-
LI: 1,
|
|
77
|
-
LK: 1,
|
|
78
|
-
LT: 1,
|
|
79
|
-
LU: 1,
|
|
80
|
-
LV: 1,
|
|
81
|
-
LY: 6,
|
|
82
|
-
MC: 1,
|
|
83
|
-
MD: 1,
|
|
84
|
-
ME: 1,
|
|
85
|
-
MK: 1,
|
|
86
|
-
MN: 1,
|
|
87
|
-
MQ: 1,
|
|
88
|
-
MV: 5,
|
|
89
|
-
MY: 1,
|
|
90
|
-
NL: 1,
|
|
91
|
-
NO: 1,
|
|
92
|
-
NZ: 1,
|
|
93
|
-
OM: 6,
|
|
94
|
-
PL: 1,
|
|
95
|
-
QA: 6,
|
|
96
|
-
RE: 1,
|
|
97
|
-
RO: 1,
|
|
98
|
-
RS: 1,
|
|
99
|
-
RU: 1,
|
|
100
|
-
SD: 6,
|
|
101
|
-
SE: 1,
|
|
102
|
-
SI: 1,
|
|
103
|
-
SK: 1,
|
|
104
|
-
SM: 1,
|
|
105
|
-
SY: 6,
|
|
106
|
-
TJ: 1,
|
|
107
|
-
TM: 1,
|
|
108
|
-
TR: 1,
|
|
109
|
-
UA: 1,
|
|
110
|
-
UY: 1,
|
|
111
|
-
UZ: 1,
|
|
112
|
-
VA: 1,
|
|
113
|
-
VN: 1,
|
|
114
|
-
XK: 1
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
function isSameDay(a, b) {
|
|
118
|
-
b = toCalendar(b, a.calendar);
|
|
119
|
-
return a.era === b.era && a.year === b.year && a.month === b.month && a.day === b.day;
|
|
1
|
+
function $parcel$export(e, n, v, s) {
|
|
2
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
120
3
|
}
|
|
4
|
+
function $parcel$exportWildcard(dest, source) {
|
|
5
|
+
Object.keys(source).forEach(function(key) {
|
|
6
|
+
if (key === 'default' || key === '__esModule' || dest.hasOwnProperty(key)) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
121
9
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
function
|
|
125
|
-
|
|
10
|
+
Object.defineProperty(dest, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function get() {
|
|
13
|
+
return source[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
126
17
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
18
|
+
return dest;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
$parcel$export(module.exports, "GregorianCalendar", () => $5adb4cba079e6f7b$export$80ee6245ec4f29ec);
|
|
22
|
+
$parcel$export(module.exports, "JapaneseCalendar", () => $4c8188d4ddf4ec96$export$b746ab2b60cdffbf);
|
|
23
|
+
$parcel$export(module.exports, "BuddhistCalendar", () => $b20daff49d96eb86$export$42d20a78301dee44);
|
|
24
|
+
$parcel$export(module.exports, "TaiwanCalendar", () => $0034fbb09326c982$export$65e01080afcb0799);
|
|
25
|
+
$parcel$export(module.exports, "PersianCalendar", () => $cae8dbfeeb52b26c$export$37fccdbfd14c5939);
|
|
26
|
+
$parcel$export(module.exports, "IndianCalendar", () => $8f8e08f6046dcac2$export$39f31c639fa15726);
|
|
27
|
+
$parcel$export(module.exports, "IslamicCivilCalendar", () => $8ba87b21dd897347$export$2066795aadd37bfc);
|
|
28
|
+
$parcel$export(module.exports, "IslamicTabularCalendar", () => $8ba87b21dd897347$export$37f0887f2f9d22f7);
|
|
29
|
+
$parcel$export(module.exports, "IslamicUmalquraCalendar", () => $8ba87b21dd897347$export$5baab4758c231076);
|
|
30
|
+
$parcel$export(module.exports, "HebrewCalendar", () => $33f6c3bb549d8eee$export$ca405048b8fb5af);
|
|
31
|
+
$parcel$export(module.exports, "EthiopicCalendar", () => $0e96efac8f672b88$export$26ba6eab5e20cd7d);
|
|
32
|
+
$parcel$export(module.exports, "EthiopicAmeteAlemCalendar", () => $0e96efac8f672b88$export$d72e0c37005a4914);
|
|
33
|
+
$parcel$export(module.exports, "CopticCalendar", () => $0e96efac8f672b88$export$fe6243cbe1a4b7c1);
|
|
34
|
+
$parcel$export(module.exports, "createCalendar", () => $ca230d05ece9bb5e$export$dd0bbc9b26defe37);
|
|
35
|
+
var $9bb5411e4ba634f9$exports = {};
|
|
36
|
+
|
|
37
|
+
$parcel$export($9bb5411e4ba634f9$exports, "CalendarDate", () => $9bb5411e4ba634f9$export$99faa760c7908e4f);
|
|
38
|
+
$parcel$export($9bb5411e4ba634f9$exports, "Time", () => $9bb5411e4ba634f9$export$680ea196effce5f);
|
|
39
|
+
$parcel$export($9bb5411e4ba634f9$exports, "CalendarDateTime", () => $9bb5411e4ba634f9$export$ca871e8dbb80966f);
|
|
40
|
+
$parcel$export($9bb5411e4ba634f9$exports, "ZonedDateTime", () => $9bb5411e4ba634f9$export$d3b7288e7994edea);
|
|
41
|
+
var $1842b789961e6c21$exports = {};
|
|
42
|
+
|
|
43
|
+
$parcel$export($1842b789961e6c21$exports, "epochFromDate", () => $1842b789961e6c21$export$bd4fb2bc8bb06fb);
|
|
44
|
+
$parcel$export($1842b789961e6c21$exports, "toCalendar", () => $1842b789961e6c21$export$b4a036af3fc0b032);
|
|
45
|
+
$parcel$export($1842b789961e6c21$exports, "getTimeZoneOffset", () => $1842b789961e6c21$export$59c99f3515d3493f);
|
|
46
|
+
$parcel$export($1842b789961e6c21$exports, "possibleAbsolutes", () => $1842b789961e6c21$export$136f38efe7caf549);
|
|
47
|
+
$parcel$export($1842b789961e6c21$exports, "toAbsolute", () => $1842b789961e6c21$export$5107c82f94518f5c);
|
|
48
|
+
$parcel$export($1842b789961e6c21$exports, "toCalendarDateTime", () => $1842b789961e6c21$export$b21e0b124e224484);
|
|
49
|
+
$parcel$export($1842b789961e6c21$exports, "toDate", () => $1842b789961e6c21$export$e67a095c620b86fe);
|
|
50
|
+
$parcel$export($1842b789961e6c21$exports, "fromAbsolute", () => $1842b789961e6c21$export$1b96692a1ba042ac);
|
|
51
|
+
$parcel$export($1842b789961e6c21$exports, "fromDate", () => $1842b789961e6c21$export$e57ff100d91bd4b9);
|
|
52
|
+
$parcel$export($1842b789961e6c21$exports, "fromDateToLocal", () => $1842b789961e6c21$export$d7f92bcd3596b086);
|
|
53
|
+
$parcel$export($1842b789961e6c21$exports, "toCalendarDate", () => $1842b789961e6c21$export$93522d1a439f3617);
|
|
54
|
+
$parcel$export($1842b789961e6c21$exports, "toDateFields", () => $1842b789961e6c21$export$6f4d78149f3f53ac);
|
|
55
|
+
$parcel$export($1842b789961e6c21$exports, "toTimeFields", () => $1842b789961e6c21$export$4d0393e732857be5);
|
|
56
|
+
$parcel$export($1842b789961e6c21$exports, "toTime", () => $1842b789961e6c21$export$d33f79e3ffc3dc83);
|
|
57
|
+
$parcel$export($1842b789961e6c21$exports, "toZoned", () => $1842b789961e6c21$export$84c95a83c799e074);
|
|
58
|
+
$parcel$export($1842b789961e6c21$exports, "toTimeZone", () => $1842b789961e6c21$export$538b00033cc11c75);
|
|
59
|
+
$parcel$export($1842b789961e6c21$exports, "zonedToDate", () => $1842b789961e6c21$export$83aac07b4c37b25);
|
|
60
|
+
$parcel$export($1842b789961e6c21$exports, "toLocalTimeZone", () => $1842b789961e6c21$export$d9b67bc93c097491);
|
|
61
|
+
|
|
62
|
+
var $77587dc5ead8743c$exports = {};
|
|
63
|
+
|
|
64
|
+
$parcel$export($77587dc5ead8743c$exports, "isSameDay", () => $77587dc5ead8743c$export$ea39ec197993aef0);
|
|
65
|
+
$parcel$export($77587dc5ead8743c$exports, "isSameMonth", () => $77587dc5ead8743c$export$a18c89cbd24170ff);
|
|
66
|
+
$parcel$export($77587dc5ead8743c$exports, "startOfMonth", () => $77587dc5ead8743c$export$a5a3b454ada2268e);
|
|
67
|
+
$parcel$export($77587dc5ead8743c$exports, "isSameYear", () => $77587dc5ead8743c$export$5841f9eb9773f25f);
|
|
68
|
+
$parcel$export($77587dc5ead8743c$exports, "startOfYear", () => $77587dc5ead8743c$export$f91e89d3d0406102);
|
|
69
|
+
$parcel$export($77587dc5ead8743c$exports, "isEqualDay", () => $77587dc5ead8743c$export$91b62ebf2ba703ee);
|
|
70
|
+
$parcel$export($77587dc5ead8743c$exports, "isEqualMonth", () => $77587dc5ead8743c$export$5a8da0c44a3afdf2);
|
|
71
|
+
$parcel$export($77587dc5ead8743c$exports, "isEqualYear", () => $77587dc5ead8743c$export$ea840f5a6dda8147);
|
|
72
|
+
$parcel$export($77587dc5ead8743c$exports, "isToday", () => $77587dc5ead8743c$export$629b0a497aa65267);
|
|
73
|
+
$parcel$export($77587dc5ead8743c$exports, "today", () => $77587dc5ead8743c$export$d0bdf45af03a6ea3);
|
|
74
|
+
$parcel$export($77587dc5ead8743c$exports, "getDayOfWeek", () => $77587dc5ead8743c$export$2061056d06d7cdf7);
|
|
75
|
+
$parcel$export($77587dc5ead8743c$exports, "now", () => $77587dc5ead8743c$export$461939dd4422153);
|
|
76
|
+
$parcel$export($77587dc5ead8743c$exports, "compareDate", () => $77587dc5ead8743c$export$68781ddf31c0090f);
|
|
77
|
+
$parcel$export($77587dc5ead8743c$exports, "compareTime", () => $77587dc5ead8743c$export$c19a80a9721b80f6);
|
|
78
|
+
$parcel$export($77587dc5ead8743c$exports, "getHoursInDay", () => $77587dc5ead8743c$export$126c91c941de7e);
|
|
79
|
+
$parcel$export($77587dc5ead8743c$exports, "getLocalTimeZone", () => $77587dc5ead8743c$export$aa8b41735afcabd2);
|
|
80
|
+
$parcel$export($77587dc5ead8743c$exports, "endOfMonth", () => $77587dc5ead8743c$export$a2258d9c4118825c);
|
|
81
|
+
$parcel$export($77587dc5ead8743c$exports, "endOfYear", () => $77587dc5ead8743c$export$8b7aa55c66d5569e);
|
|
82
|
+
$parcel$export($77587dc5ead8743c$exports, "getMinimumMonthInYear", () => $77587dc5ead8743c$export$5412ac11713b72ad);
|
|
83
|
+
$parcel$export($77587dc5ead8743c$exports, "getMinimumDayInMonth", () => $77587dc5ead8743c$export$b2f4953d301981d5);
|
|
84
|
+
$parcel$export($77587dc5ead8743c$exports, "startOfWeek", () => $77587dc5ead8743c$export$42c81a444fbfb5d4);
|
|
85
|
+
$parcel$export($77587dc5ead8743c$exports, "endOfWeek", () => $77587dc5ead8743c$export$ef8b6d9133084f4e);
|
|
86
|
+
$parcel$export($77587dc5ead8743c$exports, "getWeeksInMonth", () => $77587dc5ead8743c$export$ccc1b2479e7dd654);
|
|
87
|
+
$parcel$export($77587dc5ead8743c$exports, "minDate", () => $77587dc5ead8743c$export$5c333a116e949cdd);
|
|
88
|
+
$parcel$export($77587dc5ead8743c$exports, "maxDate", () => $77587dc5ead8743c$export$a75f2bff57811055);
|
|
89
|
+
$parcel$export($77587dc5ead8743c$exports, "isWeekend", () => $77587dc5ead8743c$export$618d60ea299da42);
|
|
90
|
+
$parcel$export($77587dc5ead8743c$exports, "isWeekday", () => $77587dc5ead8743c$export$ee9d87258e1d19ed);
|
|
91
|
+
|
|
92
|
+
const $166fa5c83bf980e5$export$7a5acbd77d414bd9 = {
|
|
93
|
+
'001': 1,
|
|
94
|
+
AD: 1,
|
|
95
|
+
AE: 6,
|
|
96
|
+
AF: 6,
|
|
97
|
+
AI: 1,
|
|
98
|
+
AL: 1,
|
|
99
|
+
AM: 1,
|
|
100
|
+
AN: 1,
|
|
101
|
+
AT: 1,
|
|
102
|
+
AX: 1,
|
|
103
|
+
AZ: 1,
|
|
104
|
+
BA: 1,
|
|
105
|
+
BE: 1,
|
|
106
|
+
BG: 1,
|
|
107
|
+
BH: 6,
|
|
108
|
+
BM: 1,
|
|
109
|
+
BN: 1,
|
|
110
|
+
BY: 1,
|
|
111
|
+
CH: 1,
|
|
112
|
+
CL: 1,
|
|
113
|
+
CM: 1,
|
|
114
|
+
CR: 1,
|
|
115
|
+
CY: 1,
|
|
116
|
+
CZ: 1,
|
|
117
|
+
DE: 1,
|
|
118
|
+
DJ: 6,
|
|
119
|
+
DK: 1,
|
|
120
|
+
DZ: 6,
|
|
121
|
+
EC: 1,
|
|
122
|
+
EE: 1,
|
|
123
|
+
EG: 6,
|
|
124
|
+
ES: 1,
|
|
125
|
+
FI: 1,
|
|
126
|
+
FJ: 1,
|
|
127
|
+
FO: 1,
|
|
128
|
+
FR: 1,
|
|
129
|
+
GB: 1,
|
|
130
|
+
GE: 1,
|
|
131
|
+
GF: 1,
|
|
132
|
+
GP: 1,
|
|
133
|
+
GR: 1,
|
|
134
|
+
HR: 1,
|
|
135
|
+
HU: 1,
|
|
136
|
+
IE: 1,
|
|
137
|
+
IQ: 6,
|
|
138
|
+
IR: 6,
|
|
139
|
+
IS: 1,
|
|
140
|
+
IT: 1,
|
|
141
|
+
JO: 6,
|
|
142
|
+
KG: 1,
|
|
143
|
+
KW: 6,
|
|
144
|
+
KZ: 1,
|
|
145
|
+
LB: 1,
|
|
146
|
+
LI: 1,
|
|
147
|
+
LK: 1,
|
|
148
|
+
LT: 1,
|
|
149
|
+
LU: 1,
|
|
150
|
+
LV: 1,
|
|
151
|
+
LY: 6,
|
|
152
|
+
MC: 1,
|
|
153
|
+
MD: 1,
|
|
154
|
+
ME: 1,
|
|
155
|
+
MK: 1,
|
|
156
|
+
MN: 1,
|
|
157
|
+
MQ: 1,
|
|
158
|
+
MV: 5,
|
|
159
|
+
MY: 1,
|
|
160
|
+
NL: 1,
|
|
161
|
+
NO: 1,
|
|
162
|
+
NZ: 1,
|
|
163
|
+
OM: 6,
|
|
164
|
+
PL: 1,
|
|
165
|
+
QA: 6,
|
|
166
|
+
RE: 1,
|
|
167
|
+
RO: 1,
|
|
168
|
+
RS: 1,
|
|
169
|
+
RU: 1,
|
|
170
|
+
SD: 6,
|
|
171
|
+
SE: 1,
|
|
172
|
+
SI: 1,
|
|
173
|
+
SK: 1,
|
|
174
|
+
SM: 1,
|
|
175
|
+
SY: 6,
|
|
176
|
+
TJ: 1,
|
|
177
|
+
TM: 1,
|
|
178
|
+
TR: 1,
|
|
179
|
+
UA: 1,
|
|
180
|
+
UY: 1,
|
|
181
|
+
UZ: 1,
|
|
182
|
+
VA: 1,
|
|
183
|
+
VN: 1,
|
|
184
|
+
XK: 1
|
|
185
|
+
};
|
|
131
186
|
|
|
132
|
-
exports.isSameMonth = isSameMonth;
|
|
133
187
|
|
|
134
|
-
function
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
b = startOfYear(b);
|
|
138
|
-
return a.era === b.era && a.year === b.year;
|
|
188
|
+
function $77587dc5ead8743c$export$ea39ec197993aef0(a, b) {
|
|
189
|
+
b = $1842b789961e6c21$export$b4a036af3fc0b032(b, a.calendar);
|
|
190
|
+
return a.era === b.era && a.year === b.year && a.month === b.month && a.day === b.day;
|
|
139
191
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
192
|
+
function $77587dc5ead8743c$export$a18c89cbd24170ff(a, b) {
|
|
193
|
+
b = $1842b789961e6c21$export$b4a036af3fc0b032(b, a.calendar);
|
|
194
|
+
// In the Japanese calendar, months can span multiple eras/years, so only compare the first of the month.
|
|
195
|
+
a = $77587dc5ead8743c$export$a5a3b454ada2268e(a);
|
|
196
|
+
b = $77587dc5ead8743c$export$a5a3b454ada2268e(b);
|
|
197
|
+
return a.era === b.era && a.year === b.year && a.month === b.month;
|
|
145
198
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
b = startOfMonth(b);
|
|
152
|
-
return a.calendar.identifier === b.calendar.identifier && a.era === b.era && a.year === b.year && a.month === b.month;
|
|
199
|
+
function $77587dc5ead8743c$export$5841f9eb9773f25f(a, b) {
|
|
200
|
+
b = $1842b789961e6c21$export$b4a036af3fc0b032(b, a.calendar);
|
|
201
|
+
a = $77587dc5ead8743c$export$f91e89d3d0406102(a);
|
|
202
|
+
b = $77587dc5ead8743c$export$f91e89d3d0406102(b);
|
|
203
|
+
return a.era === b.era && a.year === b.year;
|
|
153
204
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
function isEqualYear(a, b) {
|
|
158
|
-
a = startOfYear(a);
|
|
159
|
-
b = startOfYear(b);
|
|
160
|
-
return a.calendar.identifier === b.calendar.identifier && a.era === b.era && a.year === b.year;
|
|
205
|
+
function $77587dc5ead8743c$export$91b62ebf2ba703ee(a, b) {
|
|
206
|
+
return a.calendar.identifier === b.calendar.identifier && a.era === b.era && a.year === b.year && a.month === b.month && a.day === b.day;
|
|
161
207
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
return isSameDay(date, today(timeZone));
|
|
208
|
+
function $77587dc5ead8743c$export$5a8da0c44a3afdf2(a, b) {
|
|
209
|
+
a = $77587dc5ead8743c$export$a5a3b454ada2268e(a);
|
|
210
|
+
b = $77587dc5ead8743c$export$a5a3b454ada2268e(b);
|
|
211
|
+
return a.calendar.identifier === b.calendar.identifier && a.era === b.era && a.year === b.year && a.month === b.month;
|
|
167
212
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
let julian = date.calendar.toJulianDay(date); // If julian is negative, then julian % 7 will be negative, so we adjust
|
|
173
|
-
// accordingly. Julian day 0 is Monday.
|
|
174
|
-
|
|
175
|
-
let dayOfWeek = Math.ceil(julian + 1 - $ca0cdda43bc8e7de0f5e86$var$getWeekStart(locale)) % 7;
|
|
176
|
-
|
|
177
|
-
if (dayOfWeek < 0) {
|
|
178
|
-
dayOfWeek += 7;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
return dayOfWeek;
|
|
213
|
+
function $77587dc5ead8743c$export$ea840f5a6dda8147(a, b) {
|
|
214
|
+
a = $77587dc5ead8743c$export$f91e89d3d0406102(a);
|
|
215
|
+
b = $77587dc5ead8743c$export$f91e89d3d0406102(b);
|
|
216
|
+
return a.calendar.identifier === b.calendar.identifier && a.era === b.era && a.year === b.year;
|
|
182
217
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
function now(timeZone) {
|
|
187
|
-
return fromAbsolute(Date.now(), timeZone);
|
|
218
|
+
function $77587dc5ead8743c$export$629b0a497aa65267(date, timeZone) {
|
|
219
|
+
return $77587dc5ead8743c$export$ea39ec197993aef0(date, $77587dc5ead8743c$export$d0bdf45af03a6ea3(timeZone));
|
|
188
220
|
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
221
|
+
function $77587dc5ead8743c$export$2061056d06d7cdf7(date, locale) {
|
|
222
|
+
let julian = date.calendar.toJulianDay(date);
|
|
223
|
+
// If julian is negative, then julian % 7 will be negative, so we adjust
|
|
224
|
+
// accordingly. Julian day 0 is Monday.
|
|
225
|
+
let dayOfWeek = Math.ceil(julian + 1 - $77587dc5ead8743c$var$getWeekStart(locale)) % 7;
|
|
226
|
+
if (dayOfWeek < 0) dayOfWeek += 7;
|
|
227
|
+
return dayOfWeek;
|
|
194
228
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
function compareDate(a, b) {
|
|
199
|
-
return a.calendar.toJulianDay(a) - b.calendar.toJulianDay(b);
|
|
229
|
+
function $77587dc5ead8743c$export$461939dd4422153(timeZone) {
|
|
230
|
+
return $1842b789961e6c21$export$1b96692a1ba042ac(Date.now(), timeZone);
|
|
200
231
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
function compareTime(a, b) {
|
|
205
|
-
return $ca0cdda43bc8e7de0f5e86$var$timeToMs(a) - $ca0cdda43bc8e7de0f5e86$var$timeToMs(b);
|
|
232
|
+
function $77587dc5ead8743c$export$d0bdf45af03a6ea3(timeZone) {
|
|
233
|
+
return $1842b789961e6c21$export$93522d1a439f3617($77587dc5ead8743c$export$461939dd4422153(timeZone));
|
|
206
234
|
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
function $ca0cdda43bc8e7de0f5e86$var$timeToMs(a) {
|
|
211
|
-
return a.hour * 60 * 60 * 1000 + a.minute * 60 * 1000 + a.second * 1000 + a.millisecond;
|
|
235
|
+
function $77587dc5ead8743c$export$68781ddf31c0090f(a, b) {
|
|
236
|
+
return a.calendar.toJulianDay(a) - b.calendar.toJulianDay(b);
|
|
212
237
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
let ms = toAbsolute(a, timeZone);
|
|
216
|
-
let tomorrow = a.add({
|
|
217
|
-
days: 1
|
|
218
|
-
});
|
|
219
|
-
let tomorrowMs = toAbsolute(tomorrow, timeZone);
|
|
220
|
-
return (tomorrowMs - ms) / 3600000;
|
|
238
|
+
function $77587dc5ead8743c$export$c19a80a9721b80f6(a, b) {
|
|
239
|
+
return $77587dc5ead8743c$var$timeToMs(a) - $77587dc5ead8743c$var$timeToMs(b);
|
|
221
240
|
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
let $ca0cdda43bc8e7de0f5e86$var$localTimeZone = null;
|
|
225
|
-
|
|
226
|
-
function getLocalTimeZone() {
|
|
227
|
-
// TODO: invalidate this somehow?
|
|
228
|
-
if ($ca0cdda43bc8e7de0f5e86$var$localTimeZone == null) {
|
|
229
|
-
$ca0cdda43bc8e7de0f5e86$var$localTimeZone = new Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
return $ca0cdda43bc8e7de0f5e86$var$localTimeZone;
|
|
241
|
+
function $77587dc5ead8743c$var$timeToMs(a) {
|
|
242
|
+
return a.hour * 3600000 + a.minute * 60000 + a.second * 1000 + a.millisecond;
|
|
233
243
|
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
244
|
+
function $77587dc5ead8743c$export$126c91c941de7e(a, timeZone) {
|
|
245
|
+
let ms = $1842b789961e6c21$export$5107c82f94518f5c(a, timeZone);
|
|
246
|
+
let tomorrow = a.add({
|
|
247
|
+
days: 1
|
|
248
|
+
});
|
|
249
|
+
let tomorrowMs = $1842b789961e6c21$export$5107c82f94518f5c(tomorrow, timeZone);
|
|
250
|
+
return (tomorrowMs - ms) / 3600000;
|
|
251
|
+
}
|
|
252
|
+
let $77587dc5ead8743c$var$localTimeZone = null;
|
|
253
|
+
function $77587dc5ead8743c$export$aa8b41735afcabd2() {
|
|
254
|
+
// TODO: invalidate this somehow?
|
|
255
|
+
if ($77587dc5ead8743c$var$localTimeZone == null) $77587dc5ead8743c$var$localTimeZone = new Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
256
|
+
return $77587dc5ead8743c$var$localTimeZone;
|
|
257
|
+
}
|
|
258
|
+
function $77587dc5ead8743c$export$a5a3b454ada2268e(date) {
|
|
259
|
+
// Use `subtract` instead of `set` so we don't get constrained in an era.
|
|
260
|
+
return date.subtract({
|
|
261
|
+
days: date.day - 1
|
|
262
|
+
});
|
|
242
263
|
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
return date.add({
|
|
248
|
-
days: date.calendar.getDaysInMonth(date) - date.day
|
|
249
|
-
});
|
|
264
|
+
function $77587dc5ead8743c$export$a2258d9c4118825c(date) {
|
|
265
|
+
return date.add({
|
|
266
|
+
days: date.calendar.getDaysInMonth(date) - date.day
|
|
267
|
+
});
|
|
250
268
|
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
return startOfMonth(date.subtract({
|
|
256
|
-
months: date.month - 1
|
|
257
|
-
}));
|
|
269
|
+
function $77587dc5ead8743c$export$f91e89d3d0406102(date) {
|
|
270
|
+
return $77587dc5ead8743c$export$a5a3b454ada2268e(date.subtract({
|
|
271
|
+
months: date.month - 1
|
|
272
|
+
}));
|
|
258
273
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
return endOfMonth(date.add({
|
|
264
|
-
months: date.calendar.getMonthsInYear(date) - date.month
|
|
265
|
-
}));
|
|
274
|
+
function $77587dc5ead8743c$export$8b7aa55c66d5569e(date) {
|
|
275
|
+
return $77587dc5ead8743c$export$a2258d9c4118825c(date.add({
|
|
276
|
+
months: date.calendar.getMonthsInYear(date) - date.month
|
|
277
|
+
}));
|
|
266
278
|
}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
function getMinimumMonthInYear(date) {
|
|
271
|
-
if (date.calendar.getMinimumMonthInYear) {
|
|
272
|
-
return date.calendar.getMinimumMonthInYear(date);
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
return 1;
|
|
279
|
+
function $77587dc5ead8743c$export$5412ac11713b72ad(date) {
|
|
280
|
+
if (date.calendar.getMinimumMonthInYear) return date.calendar.getMinimumMonthInYear(date);
|
|
281
|
+
return 1;
|
|
276
282
|
}
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
function getMinimumDayInMonth(date) {
|
|
281
|
-
if (date.calendar.getMinimumDayInMonth) {
|
|
282
|
-
return date.calendar.getMinimumDayInMonth(date);
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
return 1;
|
|
283
|
+
function $77587dc5ead8743c$export$b2f4953d301981d5(date) {
|
|
284
|
+
if (date.calendar.getMinimumDayInMonth) return date.calendar.getMinimumDayInMonth(date);
|
|
285
|
+
return 1;
|
|
286
286
|
}
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
return date.subtract({
|
|
293
|
-
days: dayOfWeek
|
|
294
|
-
});
|
|
287
|
+
function $77587dc5ead8743c$export$42c81a444fbfb5d4(date, locale) {
|
|
288
|
+
let dayOfWeek = $77587dc5ead8743c$export$2061056d06d7cdf7(date, locale);
|
|
289
|
+
return date.subtract({
|
|
290
|
+
days: dayOfWeek
|
|
291
|
+
});
|
|
295
292
|
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
return startOfWeek(date, locale).add({
|
|
301
|
-
days: 6
|
|
302
|
-
});
|
|
293
|
+
function $77587dc5ead8743c$export$ef8b6d9133084f4e(date, locale) {
|
|
294
|
+
return $77587dc5ead8743c$export$42c81a444fbfb5d4(date, locale).add({
|
|
295
|
+
days: 6
|
|
296
|
+
});
|
|
303
297
|
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
region = new Intl.Locale(locale).maximize().region;
|
|
318
|
-
$ca0cdda43bc8e7de0f5e86$var$cachedRegions.set(locale, region);
|
|
298
|
+
const $77587dc5ead8743c$var$cachedRegions = new Map();
|
|
299
|
+
function $77587dc5ead8743c$var$getRegion(locale) {
|
|
300
|
+
// If the Intl.Locale API is available, use it to get the region for the locale.
|
|
301
|
+
// @ts-ignore
|
|
302
|
+
if (Intl.Locale) {
|
|
303
|
+
// Constructing an Intl.Locale is expensive, so cache the result.
|
|
304
|
+
let region = $77587dc5ead8743c$var$cachedRegions.get(locale);
|
|
305
|
+
if (!region) {
|
|
306
|
+
// @ts-ignore
|
|
307
|
+
region = new Intl.Locale(locale).maximize().region;
|
|
308
|
+
$77587dc5ead8743c$var$cachedRegions.set(locale, region);
|
|
309
|
+
}
|
|
310
|
+
return region;
|
|
319
311
|
}
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
312
|
+
// If not, just try splitting the string.
|
|
313
|
+
// If the second part of the locale string is 'u',
|
|
314
|
+
// then this is a unicode extension, so ignore it.
|
|
315
|
+
// Otherwise, it should be the region.
|
|
316
|
+
let part = locale.split('-')[1];
|
|
317
|
+
return part === 'u' ? null : part;
|
|
318
|
+
}
|
|
319
|
+
function $77587dc5ead8743c$var$getWeekStart(locale) {
|
|
320
|
+
// TODO: use Intl.Locale for this once browsers support the weekInfo property
|
|
321
|
+
// https://github.com/tc39/proposal-intl-locale-info
|
|
322
|
+
let region = $77587dc5ead8743c$var$getRegion(locale);
|
|
323
|
+
return $166fa5c83bf980e5$export$7a5acbd77d414bd9[region] || 0;
|
|
324
|
+
}
|
|
325
|
+
function $77587dc5ead8743c$export$ccc1b2479e7dd654(date, locale) {
|
|
326
|
+
let days = date.calendar.getDaysInMonth(date);
|
|
327
|
+
return Math.ceil(($77587dc5ead8743c$export$2061056d06d7cdf7($77587dc5ead8743c$export$a5a3b454ada2268e(date), locale) + days) / 7);
|
|
328
|
+
}
|
|
329
|
+
function $77587dc5ead8743c$export$5c333a116e949cdd(a, b) {
|
|
330
|
+
return a.compare(b) <= 0 ? a : b;
|
|
331
|
+
}
|
|
332
|
+
function $77587dc5ead8743c$export$a75f2bff57811055(a, b) {
|
|
333
|
+
return a.compare(b) >= 0 ? a : b;
|
|
334
|
+
}
|
|
335
|
+
const $77587dc5ead8743c$var$WEEKEND_DATA = {
|
|
336
|
+
AF: [
|
|
337
|
+
4,
|
|
338
|
+
5
|
|
339
|
+
],
|
|
340
|
+
AE: [
|
|
341
|
+
5,
|
|
342
|
+
6
|
|
343
|
+
],
|
|
344
|
+
BH: [
|
|
345
|
+
5,
|
|
346
|
+
6
|
|
347
|
+
],
|
|
348
|
+
DZ: [
|
|
349
|
+
5,
|
|
350
|
+
6
|
|
351
|
+
],
|
|
352
|
+
EG: [
|
|
353
|
+
5,
|
|
354
|
+
6
|
|
355
|
+
],
|
|
356
|
+
IL: [
|
|
357
|
+
5,
|
|
358
|
+
6
|
|
359
|
+
],
|
|
360
|
+
IQ: [
|
|
361
|
+
5,
|
|
362
|
+
6
|
|
363
|
+
],
|
|
364
|
+
IR: [
|
|
365
|
+
5,
|
|
366
|
+
5
|
|
367
|
+
],
|
|
368
|
+
JO: [
|
|
369
|
+
5,
|
|
370
|
+
6
|
|
371
|
+
],
|
|
372
|
+
KW: [
|
|
373
|
+
5,
|
|
374
|
+
6
|
|
375
|
+
],
|
|
376
|
+
LY: [
|
|
377
|
+
5,
|
|
378
|
+
6
|
|
379
|
+
],
|
|
380
|
+
OM: [
|
|
381
|
+
5,
|
|
382
|
+
6
|
|
383
|
+
],
|
|
384
|
+
QA: [
|
|
385
|
+
5,
|
|
386
|
+
6
|
|
387
|
+
],
|
|
388
|
+
SA: [
|
|
389
|
+
5,
|
|
390
|
+
6
|
|
391
|
+
],
|
|
392
|
+
SD: [
|
|
393
|
+
5,
|
|
394
|
+
6
|
|
395
|
+
],
|
|
396
|
+
SY: [
|
|
397
|
+
5,
|
|
398
|
+
6
|
|
399
|
+
],
|
|
400
|
+
YE: [
|
|
401
|
+
5,
|
|
402
|
+
6
|
|
403
|
+
]
|
|
384
404
|
};
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
let
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
405
|
+
function $77587dc5ead8743c$export$618d60ea299da42(date, locale) {
|
|
406
|
+
let julian = date.calendar.toJulianDay(date);
|
|
407
|
+
// If julian is negative, then julian % 7 will be negative, so we adjust
|
|
408
|
+
// accordingly. Julian day 0 is Monday.
|
|
409
|
+
let dayOfWeek = Math.ceil(julian + 1) % 7;
|
|
410
|
+
if (dayOfWeek < 0) dayOfWeek += 7;
|
|
411
|
+
let region = $77587dc5ead8743c$var$getRegion(locale);
|
|
412
|
+
// Use Intl.Locale for this once weekInfo is supported.
|
|
413
|
+
// https://github.com/tc39/proposal-intl-locale-info
|
|
414
|
+
let [start, end] = $77587dc5ead8743c$var$WEEKEND_DATA[region] || [
|
|
415
|
+
6,
|
|
416
|
+
0
|
|
417
|
+
];
|
|
418
|
+
return dayOfWeek === start || dayOfWeek === end;
|
|
419
|
+
}
|
|
420
|
+
function $77587dc5ead8743c$export$ee9d87258e1d19ed(date, locale) {
|
|
421
|
+
return !$77587dc5ead8743c$export$618d60ea299da42(date, locale);
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
function $4ac4a53a5fa3b797$export$842a2cf37af977e1(amount, numerator) {
|
|
428
|
+
return amount - numerator * Math.floor(amount / numerator);
|
|
429
|
+
}
|
|
430
|
+
function $4ac4a53a5fa3b797$export$784d13d8ee351f07(date) {
|
|
431
|
+
if (date.era) return new $9bb5411e4ba634f9$export$99faa760c7908e4f(date.calendar, date.era, date.year, date.month, date.day);
|
|
432
|
+
else return new $9bb5411e4ba634f9$export$99faa760c7908e4f(date.calendar, date.year, date.month, date.day);
|
|
433
|
+
}
|
|
434
|
+
function $4ac4a53a5fa3b797$export$27fa0172ae2644b3(date) {
|
|
435
|
+
if (date.era) return new $9bb5411e4ba634f9$export$ca871e8dbb80966f(date.calendar, date.era, date.year, date.month, date.day, date.hour, date.minute, date.second, date.millisecond);
|
|
436
|
+
else return new $9bb5411e4ba634f9$export$ca871e8dbb80966f(date.calendar, date.year, date.month, date.day, date.hour, date.minute, date.second);
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
const $5adb4cba079e6f7b$var$EPOCH = 1721426; // 001/01/03 Julian C.E.
|
|
441
|
+
function $5adb4cba079e6f7b$export$f297eb839006d339(year, month, day) {
|
|
442
|
+
let y1 = year - 1;
|
|
443
|
+
let monthOffset = -2;
|
|
444
|
+
if (month <= 2) monthOffset = 0;
|
|
445
|
+
else if ($5adb4cba079e6f7b$export$553d7fa8e3805fc0(year)) monthOffset = -1;
|
|
446
|
+
return $5adb4cba079e6f7b$var$EPOCH - 1 + 365 * y1 + Math.floor(y1 / 4) - Math.floor(y1 / 100) + Math.floor(y1 / 400) + Math.floor((367 * month - 362) / 12 + monthOffset + day);
|
|
447
|
+
}
|
|
448
|
+
function $5adb4cba079e6f7b$export$553d7fa8e3805fc0(year) {
|
|
449
|
+
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
450
|
+
}
|
|
451
|
+
const $5adb4cba079e6f7b$var$daysInMonth = {
|
|
452
|
+
standard: [
|
|
453
|
+
31,
|
|
454
|
+
28,
|
|
455
|
+
31,
|
|
456
|
+
30,
|
|
457
|
+
31,
|
|
458
|
+
30,
|
|
459
|
+
31,
|
|
460
|
+
31,
|
|
461
|
+
30,
|
|
462
|
+
31,
|
|
463
|
+
30,
|
|
464
|
+
31
|
|
465
|
+
],
|
|
466
|
+
leapyear: [
|
|
467
|
+
31,
|
|
468
|
+
29,
|
|
469
|
+
31,
|
|
470
|
+
30,
|
|
471
|
+
31,
|
|
472
|
+
30,
|
|
473
|
+
31,
|
|
474
|
+
31,
|
|
475
|
+
30,
|
|
476
|
+
31,
|
|
477
|
+
30,
|
|
478
|
+
31
|
|
479
|
+
]
|
|
480
|
+
};
|
|
481
|
+
class $5adb4cba079e6f7b$export$80ee6245ec4f29ec {
|
|
482
|
+
fromJulianDay(jd) {
|
|
483
|
+
let jd0 = jd;
|
|
484
|
+
let depoch = jd0 - $5adb4cba079e6f7b$var$EPOCH;
|
|
485
|
+
let quadricent = Math.floor(depoch / 146097);
|
|
486
|
+
let dqc = $4ac4a53a5fa3b797$export$842a2cf37af977e1(depoch, 146097);
|
|
487
|
+
let cent = Math.floor(dqc / 36524);
|
|
488
|
+
let dcent = $4ac4a53a5fa3b797$export$842a2cf37af977e1(dqc, 36524);
|
|
489
|
+
let quad = Math.floor(dcent / 1461);
|
|
490
|
+
let dquad = $4ac4a53a5fa3b797$export$842a2cf37af977e1(dcent, 1461);
|
|
491
|
+
let yindex = Math.floor(dquad / 365);
|
|
492
|
+
let year = quadricent * 400 + cent * 100 + quad * 4 + yindex + (cent !== 4 && yindex !== 4 ? 1 : 0);
|
|
493
|
+
let yearDay = jd0 - $5adb4cba079e6f7b$export$f297eb839006d339(year, 1, 1);
|
|
494
|
+
let leapAdj = 2;
|
|
495
|
+
if (jd0 < $5adb4cba079e6f7b$export$f297eb839006d339(year, 3, 1)) leapAdj = 0;
|
|
496
|
+
else if ($5adb4cba079e6f7b$export$553d7fa8e3805fc0(year)) leapAdj = 1;
|
|
497
|
+
let month = Math.floor(((yearDay + leapAdj) * 12 + 373) / 367);
|
|
498
|
+
let day = jd0 - $5adb4cba079e6f7b$export$f297eb839006d339(year, month, 1) + 1;
|
|
499
|
+
return new $9bb5411e4ba634f9$export$99faa760c7908e4f(this, year, month, day);
|
|
409
500
|
}
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
let day = jd0 - $fdb27fe8d5b8ff356e836fe61f3645c$export$gregorianToJulianDay(year, month, 1) + 1;
|
|
413
|
-
return new CalendarDate(this, year, month, day);
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
toJulianDay(date) {
|
|
417
|
-
return $fdb27fe8d5b8ff356e836fe61f3645c$export$gregorianToJulianDay(date.year, date.month, date.day);
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
getDaysInMonth(date) {
|
|
421
|
-
return $fdb27fe8d5b8ff356e836fe61f3645c$var$daysInMonth[$fdb27fe8d5b8ff356e836fe61f3645c$export$isLeapYear(date.year) ? 'leapyear' : 'standard'][date.month - 1];
|
|
422
|
-
} // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
getMonthsInYear(date) {
|
|
426
|
-
return 12;
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
getDaysInYear(date) {
|
|
430
|
-
return $fdb27fe8d5b8ff356e836fe61f3645c$export$isLeapYear(date.year) ? 366 : 365;
|
|
431
|
-
} // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
getYearsInEra(date) {
|
|
435
|
-
return 9999;
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
getEras() {
|
|
439
|
-
return ['BC', 'AD'];
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
getYearsToAdd(date, years) {
|
|
443
|
-
return date.era === 'BC' ? -years : years;
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
balanceDate(date) {
|
|
447
|
-
if (date.year <= 0) {
|
|
448
|
-
date.era = date.era === 'BC' ? 'AD' : 'BC';
|
|
449
|
-
date.year = 1 - date.year;
|
|
501
|
+
toJulianDay(date) {
|
|
502
|
+
return $5adb4cba079e6f7b$export$f297eb839006d339(date.year, date.month, date.day);
|
|
450
503
|
}
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
day,
|
|
483
|
-
hour,
|
|
484
|
-
minute,
|
|
485
|
-
second
|
|
486
|
-
} = $a64489f6d663f3427da3eac0e9$var$getTimeZoneParts(ms, timeZone);
|
|
487
|
-
let utc = $a64489f6d663f3427da3eac0e9$var$epochFromParts(year, month, day, hour, minute, second, 0);
|
|
488
|
-
return utc - Math.floor(ms / 1000) * 1000;
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
exports.getTimeZoneOffset = getTimeZoneOffset;
|
|
492
|
-
const $a64489f6d663f3427da3eac0e9$var$formattersByTimeZone = new Map();
|
|
493
|
-
|
|
494
|
-
function $a64489f6d663f3427da3eac0e9$var$getTimeZoneParts(ms, timeZone) {
|
|
495
|
-
let formatter = $a64489f6d663f3427da3eac0e9$var$formattersByTimeZone.get(timeZone);
|
|
496
|
-
|
|
497
|
-
if (!formatter) {
|
|
498
|
-
formatter = new Intl.DateTimeFormat('en-US', {
|
|
499
|
-
timeZone,
|
|
500
|
-
hour12: false,
|
|
501
|
-
era: 'short',
|
|
502
|
-
year: 'numeric',
|
|
503
|
-
month: 'numeric',
|
|
504
|
-
day: 'numeric',
|
|
505
|
-
hour: 'numeric',
|
|
506
|
-
minute: 'numeric',
|
|
507
|
-
second: 'numeric'
|
|
508
|
-
});
|
|
509
|
-
$a64489f6d663f3427da3eac0e9$var$formattersByTimeZone.set(timeZone, formatter);
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
let parts = formatter.formatToParts(new Date(ms));
|
|
513
|
-
let namedParts = {};
|
|
514
|
-
|
|
515
|
-
for (let part of parts) {
|
|
516
|
-
if (part.type !== 'literal') {
|
|
517
|
-
namedParts[part.type] = part.value;
|
|
504
|
+
getDaysInMonth(date) {
|
|
505
|
+
return $5adb4cba079e6f7b$var$daysInMonth[$5adb4cba079e6f7b$export$553d7fa8e3805fc0(date.year) ? 'leapyear' : 'standard'][date.month - 1];
|
|
506
|
+
}
|
|
507
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
508
|
+
getMonthsInYear(date) {
|
|
509
|
+
return 12;
|
|
510
|
+
}
|
|
511
|
+
getDaysInYear(date) {
|
|
512
|
+
return $5adb4cba079e6f7b$export$553d7fa8e3805fc0(date.year) ? 366 : 365;
|
|
513
|
+
}
|
|
514
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
515
|
+
getYearsInEra(date) {
|
|
516
|
+
return 9999;
|
|
517
|
+
}
|
|
518
|
+
getEras() {
|
|
519
|
+
return [
|
|
520
|
+
'BC',
|
|
521
|
+
'AD'
|
|
522
|
+
];
|
|
523
|
+
}
|
|
524
|
+
getYearsToAdd(date, years) {
|
|
525
|
+
return date.era === 'BC' ? -years : years;
|
|
526
|
+
}
|
|
527
|
+
balanceDate(date) {
|
|
528
|
+
if (date.year <= 0) {
|
|
529
|
+
date.era = date.era === 'BC' ? 'AD' : 'BC';
|
|
530
|
+
date.year = 1 - date.year;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
constructor(){
|
|
534
|
+
this.identifier = 'gregory';
|
|
518
535
|
}
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
return {
|
|
522
|
-
year: namedParts.era === 'BC' ? -namedParts.year + 1 : +namedParts.year,
|
|
523
|
-
month: +namedParts.month,
|
|
524
|
-
day: +namedParts.day,
|
|
525
|
-
hour: namedParts.hour === '24' ? 0 : +namedParts.hour,
|
|
526
|
-
// bugs.chromium.org/p/chromium/issues/detail?id=1045791
|
|
527
|
-
minute: +namedParts.minute,
|
|
528
|
-
second: +namedParts.second
|
|
529
|
-
};
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
const $a64489f6d663f3427da3eac0e9$var$DAYMILLIS = 86400000;
|
|
533
|
-
|
|
534
|
-
function possibleAbsolutes(date, timeZone) {
|
|
535
|
-
let ms = epochFromDate(date);
|
|
536
|
-
let earlier = ms - getTimeZoneOffset(ms - $a64489f6d663f3427da3eac0e9$var$DAYMILLIS, timeZone);
|
|
537
|
-
let later = ms - getTimeZoneOffset(ms + $a64489f6d663f3427da3eac0e9$var$DAYMILLIS, timeZone);
|
|
538
|
-
return $a64489f6d663f3427da3eac0e9$var$getValidWallTimes(date, timeZone, earlier, later);
|
|
539
536
|
}
|
|
540
537
|
|
|
541
|
-
exports.possibleAbsolutes = possibleAbsolutes;
|
|
542
|
-
|
|
543
|
-
function $a64489f6d663f3427da3eac0e9$var$getValidWallTimes(date, timeZone, earlier, later) {
|
|
544
|
-
let found = earlier === later ? [earlier] : [earlier, later];
|
|
545
|
-
return found.filter(absolute => $a64489f6d663f3427da3eac0e9$var$isValidWallTime(date, timeZone, absolute));
|
|
546
|
-
}
|
|
547
538
|
|
|
548
|
-
function $
|
|
549
|
-
|
|
550
|
-
|
|
539
|
+
function $1842b789961e6c21$export$bd4fb2bc8bb06fb(date) {
|
|
540
|
+
date = $1842b789961e6c21$export$b4a036af3fc0b032(date, new $5adb4cba079e6f7b$export$80ee6245ec4f29ec());
|
|
541
|
+
return $1842b789961e6c21$var$epochFromParts(date.year, date.month, date.day, date.hour, date.minute, date.second, date.millisecond);
|
|
551
542
|
}
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
disambiguation = 'compatible';
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
let dateTime = toCalendarDateTime(date); // Fast path: if the time zone is the local timezone and disambiguation is compatible, use native Date.
|
|
559
|
-
|
|
560
|
-
if (timeZone === getLocalTimeZone() && disambiguation === 'compatible') {
|
|
561
|
-
dateTime = toCalendar(dateTime, new GregorianCalendar()); // Don't use Date constructor here because two-digit years are interpreted in the 20th century.
|
|
562
|
-
|
|
543
|
+
function $1842b789961e6c21$var$epochFromParts(year, month, day, hour, minute, second, millisecond) {
|
|
544
|
+
// Note: Date.UTC() interprets one and two-digit years as being in the
|
|
545
|
+
// 20th century, so don't use it
|
|
563
546
|
let date = new Date();
|
|
564
|
-
date.
|
|
565
|
-
date.
|
|
547
|
+
date.setUTCHours(hour, minute, second, millisecond);
|
|
548
|
+
date.setUTCFullYear(year, month - 1, day);
|
|
566
549
|
return date.getTime();
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
let ms = epochFromDate(dateTime);
|
|
570
|
-
let offsetBefore = getTimeZoneOffset(ms - $a64489f6d663f3427da3eac0e9$var$DAYMILLIS, timeZone);
|
|
571
|
-
let offsetAfter = getTimeZoneOffset(ms + $a64489f6d663f3427da3eac0e9$var$DAYMILLIS, timeZone);
|
|
572
|
-
let valid = $a64489f6d663f3427da3eac0e9$var$getValidWallTimes(dateTime, timeZone, ms - offsetBefore, ms - offsetAfter);
|
|
573
|
-
|
|
574
|
-
if (valid.length === 1) {
|
|
575
|
-
return valid[0];
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
if (valid.length > 1) {
|
|
579
|
-
switch (disambiguation) {
|
|
580
|
-
// 'compatible' means 'earlier' for "fall back" transitions
|
|
581
|
-
case 'compatible':
|
|
582
|
-
case 'earlier':
|
|
583
|
-
return valid[0];
|
|
584
|
-
|
|
585
|
-
case 'later':
|
|
586
|
-
return valid[valid.length - 1];
|
|
587
|
-
|
|
588
|
-
case 'reject':
|
|
589
|
-
throw new RangeError('Multiple possible absolute times found');
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
switch (disambiguation) {
|
|
594
|
-
case 'earlier':
|
|
595
|
-
return Math.min(ms - offsetBefore, ms - offsetAfter);
|
|
596
|
-
// 'compatible' means 'later' for "spring forward" transitions
|
|
597
|
-
|
|
598
|
-
case 'compatible':
|
|
599
|
-
case 'later':
|
|
600
|
-
return Math.max(ms - offsetBefore, ms - offsetAfter);
|
|
601
|
-
|
|
602
|
-
case 'reject':
|
|
603
|
-
throw new RangeError('No such absolute time found');
|
|
604
|
-
}
|
|
605
550
|
}
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
551
|
+
function $1842b789961e6c21$export$59c99f3515d3493f(ms, timeZone) {
|
|
552
|
+
// Fast path: for local timezone, use native Date.
|
|
553
|
+
if (timeZone === $77587dc5ead8743c$export$aa8b41735afcabd2()) return new Date(ms).getTimezoneOffset() * -60000;
|
|
554
|
+
let { year: year , month: month , day: day , hour: hour , minute: minute , second: second } = $1842b789961e6c21$var$getTimeZoneParts(ms, timeZone);
|
|
555
|
+
let utc = $1842b789961e6c21$var$epochFromParts(year, month, day, hour, minute, second, 0);
|
|
556
|
+
return utc - Math.floor(ms / 1000) * 1000;
|
|
557
|
+
}
|
|
558
|
+
const $1842b789961e6c21$var$formattersByTimeZone = new Map();
|
|
559
|
+
function $1842b789961e6c21$var$getTimeZoneParts(ms, timeZone) {
|
|
560
|
+
let formatter = $1842b789961e6c21$var$formattersByTimeZone.get(timeZone);
|
|
561
|
+
if (!formatter) {
|
|
562
|
+
formatter = new Intl.DateTimeFormat('en-US', {
|
|
563
|
+
timeZone: timeZone,
|
|
564
|
+
hour12: false,
|
|
565
|
+
era: 'short',
|
|
566
|
+
year: 'numeric',
|
|
567
|
+
month: 'numeric',
|
|
568
|
+
day: 'numeric',
|
|
569
|
+
hour: 'numeric',
|
|
570
|
+
minute: 'numeric',
|
|
571
|
+
second: 'numeric'
|
|
572
|
+
});
|
|
573
|
+
$1842b789961e6c21$var$formattersByTimeZone.set(timeZone, formatter);
|
|
574
|
+
}
|
|
575
|
+
let parts = formatter.formatToParts(new Date(ms));
|
|
576
|
+
let namedParts = {
|
|
577
|
+
};
|
|
578
|
+
for (let part of parts)if (part.type !== 'literal') namedParts[part.type] = part.value;
|
|
579
|
+
return {
|
|
580
|
+
year: namedParts.era === 'BC' ? -namedParts.year + 1 : +namedParts.year,
|
|
581
|
+
month: +namedParts.month,
|
|
582
|
+
day: +namedParts.day,
|
|
583
|
+
hour: namedParts.hour === '24' ? 0 : +namedParts.hour,
|
|
584
|
+
minute: +namedParts.minute,
|
|
585
|
+
second: +namedParts.second
|
|
586
|
+
};
|
|
587
|
+
}
|
|
588
|
+
const $1842b789961e6c21$var$DAYMILLIS = 86400000;
|
|
589
|
+
function $1842b789961e6c21$export$136f38efe7caf549(date, timeZone) {
|
|
590
|
+
let ms = $1842b789961e6c21$export$bd4fb2bc8bb06fb(date);
|
|
591
|
+
let earlier = ms - $1842b789961e6c21$export$59c99f3515d3493f(ms - $1842b789961e6c21$var$DAYMILLIS, timeZone);
|
|
592
|
+
let later = ms - $1842b789961e6c21$export$59c99f3515d3493f(ms + $1842b789961e6c21$var$DAYMILLIS, timeZone);
|
|
593
|
+
return $1842b789961e6c21$var$getValidWallTimes(date, timeZone, earlier, later);
|
|
594
|
+
}
|
|
595
|
+
function $1842b789961e6c21$var$getValidWallTimes(date, timeZone, earlier, later) {
|
|
596
|
+
let found = earlier === later ? [
|
|
597
|
+
earlier
|
|
598
|
+
] : [
|
|
599
|
+
earlier,
|
|
600
|
+
later
|
|
601
|
+
];
|
|
602
|
+
return found.filter((absolute)=>$1842b789961e6c21$var$isValidWallTime(date, timeZone, absolute)
|
|
603
|
+
);
|
|
604
|
+
}
|
|
605
|
+
function $1842b789961e6c21$var$isValidWallTime(date, timeZone, absolute) {
|
|
606
|
+
let parts = $1842b789961e6c21$var$getTimeZoneParts(absolute, timeZone);
|
|
607
|
+
return date.year === parts.year && date.month === parts.month && date.day === parts.day && date.hour === parts.hour && date.minute === parts.minute && date.second === parts.second;
|
|
608
|
+
}
|
|
609
|
+
function $1842b789961e6c21$export$5107c82f94518f5c(date, timeZone, disambiguation = 'compatible') {
|
|
610
|
+
let dateTime = $1842b789961e6c21$export$b21e0b124e224484(date);
|
|
611
|
+
// Fast path: if the time zone is the local timezone and disambiguation is compatible, use native Date.
|
|
612
|
+
if (timeZone === $77587dc5ead8743c$export$aa8b41735afcabd2() && disambiguation === 'compatible') {
|
|
613
|
+
dateTime = $1842b789961e6c21$export$b4a036af3fc0b032(dateTime, new $5adb4cba079e6f7b$export$80ee6245ec4f29ec());
|
|
614
|
+
// Don't use Date constructor here because two-digit years are interpreted in the 20th century.
|
|
615
|
+
let date = new Date();
|
|
616
|
+
date.setFullYear(dateTime.year, dateTime.month - 1, dateTime.day);
|
|
617
|
+
date.setHours(dateTime.hour, dateTime.minute, dateTime.second, dateTime.millisecond);
|
|
618
|
+
return date.getTime();
|
|
619
|
+
}
|
|
620
|
+
let ms = $1842b789961e6c21$export$bd4fb2bc8bb06fb(dateTime);
|
|
621
|
+
let offsetBefore = $1842b789961e6c21$export$59c99f3515d3493f(ms - $1842b789961e6c21$var$DAYMILLIS, timeZone);
|
|
622
|
+
let offsetAfter = $1842b789961e6c21$export$59c99f3515d3493f(ms + $1842b789961e6c21$var$DAYMILLIS, timeZone);
|
|
623
|
+
let valid = $1842b789961e6c21$var$getValidWallTimes(dateTime, timeZone, ms - offsetBefore, ms - offsetAfter);
|
|
624
|
+
if (valid.length === 1) return valid[0];
|
|
625
|
+
if (valid.length > 1) switch(disambiguation){
|
|
626
|
+
// 'compatible' means 'earlier' for "fall back" transitions
|
|
627
|
+
case 'compatible':
|
|
628
|
+
case 'earlier':
|
|
629
|
+
return valid[0];
|
|
630
|
+
case 'later':
|
|
631
|
+
return valid[valid.length - 1];
|
|
632
|
+
case 'reject':
|
|
633
|
+
throw new RangeError('Multiple possible absolute times found');
|
|
634
|
+
}
|
|
635
|
+
switch(disambiguation){
|
|
636
|
+
case 'earlier':
|
|
637
|
+
return Math.min(ms - offsetBefore, ms - offsetAfter);
|
|
638
|
+
// 'compatible' means 'later' for "spring forward" transitions
|
|
639
|
+
case 'compatible':
|
|
640
|
+
case 'later':
|
|
641
|
+
return Math.max(ms - offsetBefore, ms - offsetAfter);
|
|
642
|
+
case 'reject':
|
|
643
|
+
throw new RangeError('No such absolute time found');
|
|
644
|
+
}
|
|
615
645
|
}
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
function
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
646
|
+
function $1842b789961e6c21$export$e67a095c620b86fe(dateTime, timeZone, disambiguation = 'compatible') {
|
|
647
|
+
return new Date($1842b789961e6c21$export$5107c82f94518f5c(dateTime, timeZone, disambiguation));
|
|
648
|
+
}
|
|
649
|
+
function $1842b789961e6c21$export$1b96692a1ba042ac(ms, timeZone) {
|
|
650
|
+
let offset = $1842b789961e6c21$export$59c99f3515d3493f(ms, timeZone);
|
|
651
|
+
let date = new Date(ms + offset);
|
|
652
|
+
let year = date.getUTCFullYear();
|
|
653
|
+
let month = date.getUTCMonth() + 1;
|
|
654
|
+
let day = date.getUTCDate();
|
|
655
|
+
let hour = date.getUTCHours();
|
|
656
|
+
let minute = date.getUTCMinutes();
|
|
657
|
+
let second = date.getUTCSeconds();
|
|
658
|
+
let millisecond = date.getUTCMilliseconds();
|
|
659
|
+
return new $9bb5411e4ba634f9$export$d3b7288e7994edea(year, month, day, timeZone, offset, hour, minute, second, millisecond);
|
|
660
|
+
}
|
|
661
|
+
function $1842b789961e6c21$export$e57ff100d91bd4b9(date, timeZone) {
|
|
662
|
+
return $1842b789961e6c21$export$1b96692a1ba042ac(date.getTime(), timeZone);
|
|
663
|
+
}
|
|
664
|
+
function $1842b789961e6c21$export$d7f92bcd3596b086(date) {
|
|
665
|
+
return $1842b789961e6c21$export$e57ff100d91bd4b9(date, $77587dc5ead8743c$export$aa8b41735afcabd2());
|
|
666
|
+
}
|
|
667
|
+
function $1842b789961e6c21$export$93522d1a439f3617(dateTime) {
|
|
668
|
+
return new $9bb5411e4ba634f9$export$99faa760c7908e4f(dateTime.calendar, dateTime.era, dateTime.year, dateTime.month, dateTime.day);
|
|
669
|
+
}
|
|
670
|
+
function $1842b789961e6c21$export$6f4d78149f3f53ac(date) {
|
|
671
|
+
return {
|
|
672
|
+
era: date.era,
|
|
673
|
+
year: date.year,
|
|
674
|
+
month: date.month,
|
|
675
|
+
day: date.day
|
|
676
|
+
};
|
|
677
|
+
}
|
|
678
|
+
function $1842b789961e6c21$export$4d0393e732857be5(date) {
|
|
679
|
+
return {
|
|
680
|
+
hour: date.hour,
|
|
681
|
+
minute: date.minute,
|
|
682
|
+
second: date.second,
|
|
683
|
+
millisecond: date.millisecond
|
|
684
|
+
};
|
|
685
|
+
}
|
|
686
|
+
function $1842b789961e6c21$export$b21e0b124e224484(date, time) {
|
|
687
|
+
let hour = 0, minute = 0, second = 0, millisecond = 0;
|
|
688
|
+
if ('timeZone' in date) ({ hour: hour , minute: minute , second: second , millisecond: millisecond } = date);
|
|
689
|
+
else if ('hour' in date && !time) return date;
|
|
690
|
+
if (time) ({ hour: hour , minute: minute , second: second , millisecond: millisecond } = time);
|
|
691
|
+
return new $9bb5411e4ba634f9$export$ca871e8dbb80966f(date.calendar, date.era, date.year, date.month, date.day, hour, minute, second, millisecond);
|
|
692
|
+
}
|
|
693
|
+
function $1842b789961e6c21$export$d33f79e3ffc3dc83(dateTime) {
|
|
694
|
+
return new $9bb5411e4ba634f9$export$680ea196effce5f(dateTime.hour, dateTime.minute, dateTime.second, dateTime.millisecond);
|
|
695
|
+
}
|
|
696
|
+
function $1842b789961e6c21$export$b4a036af3fc0b032(date, calendar) {
|
|
697
|
+
if (date.calendar.identifier === calendar.identifier) return date;
|
|
698
|
+
let calendarDate = calendar.fromJulianDay(date.calendar.toJulianDay(date));
|
|
699
|
+
let copy = date.copy();
|
|
700
|
+
copy.calendar = calendar;
|
|
701
|
+
copy.era = calendarDate.era;
|
|
702
|
+
copy.year = calendarDate.year;
|
|
703
|
+
copy.month = calendarDate.month;
|
|
704
|
+
copy.day = calendarDate.day;
|
|
705
|
+
return copy;
|
|
706
|
+
}
|
|
707
|
+
function $1842b789961e6c21$export$84c95a83c799e074(date, timeZone, disambiguation) {
|
|
708
|
+
if (date instanceof $9bb5411e4ba634f9$export$d3b7288e7994edea) {
|
|
709
|
+
if (date.timeZone === timeZone) return date;
|
|
710
|
+
return $1842b789961e6c21$export$538b00033cc11c75(date, timeZone);
|
|
711
|
+
}
|
|
712
|
+
let ms = $1842b789961e6c21$export$5107c82f94518f5c(date, timeZone, disambiguation);
|
|
713
|
+
return $1842b789961e6c21$export$1b96692a1ba042ac(ms, timeZone);
|
|
714
|
+
}
|
|
715
|
+
function $1842b789961e6c21$export$83aac07b4c37b25(date) {
|
|
716
|
+
let ms = $1842b789961e6c21$export$bd4fb2bc8bb06fb(date) - date.offset;
|
|
717
|
+
return new Date(ms);
|
|
718
|
+
}
|
|
719
|
+
function $1842b789961e6c21$export$538b00033cc11c75(date, timeZone) {
|
|
720
|
+
let ms = $1842b789961e6c21$export$bd4fb2bc8bb06fb(date) - date.offset;
|
|
721
|
+
return $1842b789961e6c21$export$b4a036af3fc0b032($1842b789961e6c21$export$1b96692a1ba042ac(ms, timeZone), date.calendar);
|
|
722
|
+
}
|
|
723
|
+
function $1842b789961e6c21$export$d9b67bc93c097491(date) {
|
|
724
|
+
return $1842b789961e6c21$export$538b00033cc11c75(date, $77587dc5ead8743c$export$aa8b41735afcabd2());
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
|
|
728
|
+
|
|
729
|
+
const $2ae8fe19e7cd4af8$var$ONE_HOUR = 3600000;
|
|
730
|
+
function $2ae8fe19e7cd4af8$export$e16d8520af44a096(date, duration) {
|
|
731
|
+
let mutableDate = date.copy();
|
|
732
|
+
let days = 'hour' in date ? $2ae8fe19e7cd4af8$var$addTimeFields(date, duration) : 0;
|
|
733
|
+
$2ae8fe19e7cd4af8$var$addYears(mutableDate, duration.years || 0);
|
|
734
|
+
if (mutableDate.calendar.balanceYearMonth) mutableDate.calendar.balanceYearMonth(mutableDate, date);
|
|
735
|
+
mutableDate.month += duration.months || 0;
|
|
736
|
+
$2ae8fe19e7cd4af8$var$balanceYearMonth(mutableDate);
|
|
737
|
+
$2ae8fe19e7cd4af8$var$constrainMonthDay(mutableDate);
|
|
738
|
+
mutableDate.day += (duration.weeks || 0) * 7;
|
|
739
|
+
mutableDate.day += duration.days || 0;
|
|
740
|
+
mutableDate.day += days;
|
|
741
|
+
$2ae8fe19e7cd4af8$var$balanceDay(mutableDate);
|
|
742
|
+
if (mutableDate.calendar.balanceDate) mutableDate.calendar.balanceDate(mutableDate);
|
|
743
|
+
return mutableDate;
|
|
744
|
+
}
|
|
745
|
+
function $2ae8fe19e7cd4af8$var$addYears(date, years) {
|
|
746
|
+
if (date.calendar.getYearsToAdd) years = date.calendar.getYearsToAdd(date, years);
|
|
747
|
+
date.year += years;
|
|
748
|
+
}
|
|
749
|
+
function $2ae8fe19e7cd4af8$var$balanceYearMonth(date) {
|
|
750
|
+
while(date.month < 1){
|
|
751
|
+
$2ae8fe19e7cd4af8$var$addYears(date, -1);
|
|
752
|
+
date.month += date.calendar.getMonthsInYear(date);
|
|
753
|
+
}
|
|
754
|
+
let monthsInYear = 0;
|
|
755
|
+
while(date.month > (monthsInYear = date.calendar.getMonthsInYear(date))){
|
|
756
|
+
date.month -= monthsInYear;
|
|
757
|
+
$2ae8fe19e7cd4af8$var$addYears(date, 1);
|
|
758
|
+
}
|
|
630
759
|
}
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
760
|
+
function $2ae8fe19e7cd4af8$var$balanceDay(date) {
|
|
761
|
+
while(date.day < 1){
|
|
762
|
+
date.month--;
|
|
763
|
+
$2ae8fe19e7cd4af8$var$balanceYearMonth(date);
|
|
764
|
+
date.day += date.calendar.getDaysInMonth(date);
|
|
765
|
+
}
|
|
766
|
+
while(date.day > date.calendar.getDaysInMonth(date)){
|
|
767
|
+
date.day -= date.calendar.getDaysInMonth(date);
|
|
768
|
+
date.month++;
|
|
769
|
+
$2ae8fe19e7cd4af8$var$balanceYearMonth(date);
|
|
770
|
+
}
|
|
636
771
|
}
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
772
|
+
function $2ae8fe19e7cd4af8$var$constrainMonthDay(date) {
|
|
773
|
+
date.month = Math.max(1, Math.min(date.calendar.getMonthsInYear(date), date.month));
|
|
774
|
+
date.day = Math.max(1, Math.min(date.calendar.getDaysInMonth(date), date.day));
|
|
775
|
+
}
|
|
776
|
+
function $2ae8fe19e7cd4af8$export$c4e2ecac49351ef2(date) {
|
|
777
|
+
if (date.calendar.constrainDate) date.calendar.constrainDate(date);
|
|
778
|
+
date.year = Math.max(1, Math.min(date.calendar.getYearsInEra(date), date.year));
|
|
779
|
+
$2ae8fe19e7cd4af8$var$constrainMonthDay(date);
|
|
780
|
+
}
|
|
781
|
+
function $2ae8fe19e7cd4af8$export$3e2544e88a25bff8(duration) {
|
|
782
|
+
let inverseDuration = {
|
|
783
|
+
};
|
|
784
|
+
for(let key in duration)if (typeof duration[key] === 'number') inverseDuration[key] = -duration[key];
|
|
785
|
+
return inverseDuration;
|
|
786
|
+
}
|
|
787
|
+
function $2ae8fe19e7cd4af8$export$4e2d2ead65e5f7e3(date, duration) {
|
|
788
|
+
return $2ae8fe19e7cd4af8$export$e16d8520af44a096(date, $2ae8fe19e7cd4af8$export$3e2544e88a25bff8(duration));
|
|
789
|
+
}
|
|
790
|
+
function $2ae8fe19e7cd4af8$export$adaa4cf7ef1b65be(date, fields) {
|
|
791
|
+
let mutableDate = date.copy();
|
|
792
|
+
if (fields.era != null) mutableDate.era = fields.era;
|
|
793
|
+
if (fields.year != null) mutableDate.year = fields.year;
|
|
794
|
+
if (fields.month != null) mutableDate.month = fields.month;
|
|
795
|
+
if (fields.day != null) mutableDate.day = fields.day;
|
|
796
|
+
$2ae8fe19e7cd4af8$export$c4e2ecac49351ef2(mutableDate);
|
|
797
|
+
return mutableDate;
|
|
798
|
+
}
|
|
799
|
+
function $2ae8fe19e7cd4af8$export$e5d5e1c1822b6e56(value, fields) {
|
|
800
|
+
let mutableValue = value.copy();
|
|
801
|
+
if (fields.hour != null) mutableValue.hour = fields.hour;
|
|
802
|
+
if (fields.minute != null) mutableValue.minute = fields.minute;
|
|
803
|
+
if (fields.second != null) mutableValue.second = fields.second;
|
|
804
|
+
if (fields.millisecond != null) mutableValue.millisecond = fields.millisecond;
|
|
805
|
+
$2ae8fe19e7cd4af8$export$7555de1e070510cb(mutableValue);
|
|
806
|
+
return mutableValue;
|
|
807
|
+
}
|
|
808
|
+
function $2ae8fe19e7cd4af8$var$balanceTime(time) {
|
|
809
|
+
time.second += Math.floor(time.millisecond / 1000);
|
|
810
|
+
time.millisecond = $2ae8fe19e7cd4af8$var$nonNegativeMod(time.millisecond, 1000);
|
|
811
|
+
time.minute += Math.floor(time.second / 60);
|
|
812
|
+
time.second = $2ae8fe19e7cd4af8$var$nonNegativeMod(time.second, 60);
|
|
813
|
+
time.hour += Math.floor(time.minute / 60);
|
|
814
|
+
time.minute = $2ae8fe19e7cd4af8$var$nonNegativeMod(time.minute, 60);
|
|
815
|
+
let days = Math.floor(time.hour / 24);
|
|
816
|
+
time.hour = $2ae8fe19e7cd4af8$var$nonNegativeMod(time.hour, 24);
|
|
817
|
+
return days;
|
|
818
|
+
}
|
|
819
|
+
function $2ae8fe19e7cd4af8$export$7555de1e070510cb(time) {
|
|
820
|
+
time.millisecond = Math.max(0, Math.min(time.millisecond, 1000));
|
|
821
|
+
time.second = Math.max(0, Math.min(time.second, 59));
|
|
822
|
+
time.minute = Math.max(0, Math.min(time.minute, 59));
|
|
823
|
+
time.hour = Math.max(0, Math.min(time.hour, 23));
|
|
824
|
+
}
|
|
825
|
+
function $2ae8fe19e7cd4af8$var$nonNegativeMod(a, b) {
|
|
826
|
+
let result = a % b;
|
|
827
|
+
if (result < 0) result += b;
|
|
828
|
+
return result;
|
|
829
|
+
}
|
|
830
|
+
function $2ae8fe19e7cd4af8$var$addTimeFields(time, duration) {
|
|
831
|
+
time.hour += duration.hours || 0;
|
|
832
|
+
time.minute += duration.minutes || 0;
|
|
833
|
+
time.second += duration.seconds || 0;
|
|
834
|
+
time.millisecond += duration.milliseconds || 0;
|
|
835
|
+
return $2ae8fe19e7cd4af8$var$balanceTime(time);
|
|
836
|
+
}
|
|
837
|
+
function $2ae8fe19e7cd4af8$export$7ed87b6bc2506470(time, duration) {
|
|
838
|
+
let res = time.copy();
|
|
839
|
+
$2ae8fe19e7cd4af8$var$addTimeFields(res, duration);
|
|
840
|
+
return res;
|
|
642
841
|
}
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
function
|
|
647
|
-
|
|
842
|
+
function $2ae8fe19e7cd4af8$export$fe34d3a381cd7501(time, duration) {
|
|
843
|
+
return $2ae8fe19e7cd4af8$export$7ed87b6bc2506470(time, $2ae8fe19e7cd4af8$export$3e2544e88a25bff8(duration));
|
|
844
|
+
}
|
|
845
|
+
function $2ae8fe19e7cd4af8$export$d52ced6badfb9a4c(value, field, amount, options) {
|
|
846
|
+
let mutable = value.copy();
|
|
847
|
+
switch(field){
|
|
848
|
+
case 'era':
|
|
849
|
+
{
|
|
850
|
+
let eras = value.calendar.getEras();
|
|
851
|
+
let eraIndex = eras.indexOf(value.era);
|
|
852
|
+
if (eraIndex < 0) throw new Error('Invalid era: ' + value.era);
|
|
853
|
+
eraIndex = $2ae8fe19e7cd4af8$var$cycleValue(eraIndex, amount, 0, eras.length - 1, options?.round);
|
|
854
|
+
mutable.era = eras[eraIndex];
|
|
855
|
+
// Constrain the year and other fields within the era, so the era doesn't change when we balance below.
|
|
856
|
+
$2ae8fe19e7cd4af8$export$c4e2ecac49351ef2(mutable);
|
|
857
|
+
break;
|
|
858
|
+
}
|
|
859
|
+
case 'year':
|
|
860
|
+
if (mutable.calendar.getYearsToAdd) amount = mutable.calendar.getYearsToAdd(mutable, amount);
|
|
861
|
+
// The year field should not cycle within the era as that can cause weird behavior affecting other fields.
|
|
862
|
+
// We need to also allow values < 1 so that decrementing goes to the previous era. If we get -Infinity back
|
|
863
|
+
// we know we wrapped around after reaching 9999 (the maximum), so set the year back to 1.
|
|
864
|
+
mutable.year = $2ae8fe19e7cd4af8$var$cycleValue(value.year, amount, -Infinity, 9999, options?.round);
|
|
865
|
+
if (mutable.year === -Infinity) mutable.year = 1;
|
|
866
|
+
if (mutable.calendar.balanceYearMonth) mutable.calendar.balanceYearMonth(mutable, value);
|
|
867
|
+
break;
|
|
868
|
+
case 'month':
|
|
869
|
+
mutable.month = $2ae8fe19e7cd4af8$var$cycleValue(value.month, amount, 1, value.calendar.getMonthsInYear(value), options?.round);
|
|
870
|
+
break;
|
|
871
|
+
case 'day':
|
|
872
|
+
mutable.day = $2ae8fe19e7cd4af8$var$cycleValue(value.day, amount, 1, value.calendar.getDaysInMonth(value), options?.round);
|
|
873
|
+
break;
|
|
874
|
+
default:
|
|
875
|
+
throw new Error('Unsupported field ' + field);
|
|
876
|
+
}
|
|
877
|
+
if (value.calendar.balanceDate) value.calendar.balanceDate(mutable);
|
|
878
|
+
$2ae8fe19e7cd4af8$export$c4e2ecac49351ef2(mutable);
|
|
879
|
+
return mutable;
|
|
880
|
+
}
|
|
881
|
+
function $2ae8fe19e7cd4af8$export$dd02b3e0007dfe28(value, field, amount, options) {
|
|
882
|
+
let mutable = value.copy();
|
|
883
|
+
switch(field){
|
|
884
|
+
case 'hour':
|
|
885
|
+
{
|
|
886
|
+
let hours = value.hour;
|
|
887
|
+
let min = 0;
|
|
888
|
+
let max = 23;
|
|
889
|
+
if (options?.hourCycle === 12) {
|
|
890
|
+
let isPM = hours >= 12;
|
|
891
|
+
min = isPM ? 12 : 0;
|
|
892
|
+
max = isPM ? 23 : 11;
|
|
893
|
+
}
|
|
894
|
+
mutable.hour = $2ae8fe19e7cd4af8$var$cycleValue(hours, amount, min, max, options?.round);
|
|
895
|
+
break;
|
|
896
|
+
}
|
|
897
|
+
case 'minute':
|
|
898
|
+
mutable.minute = $2ae8fe19e7cd4af8$var$cycleValue(value.minute, amount, 0, 59, options?.round);
|
|
899
|
+
break;
|
|
900
|
+
case 'second':
|
|
901
|
+
mutable.second = $2ae8fe19e7cd4af8$var$cycleValue(value.second, amount, 0, 59, options?.round);
|
|
902
|
+
break;
|
|
903
|
+
case 'millisecond':
|
|
904
|
+
mutable.millisecond = $2ae8fe19e7cd4af8$var$cycleValue(value.millisecond, amount, 0, 999, options?.round);
|
|
905
|
+
break;
|
|
906
|
+
default:
|
|
907
|
+
throw new Error('Unsupported field ' + field);
|
|
908
|
+
}
|
|
909
|
+
return mutable;
|
|
910
|
+
}
|
|
911
|
+
function $2ae8fe19e7cd4af8$var$cycleValue(value, amount, min, max, round = false) {
|
|
912
|
+
if (round) {
|
|
913
|
+
value += Math.sign(amount);
|
|
914
|
+
if (value < min) value = max;
|
|
915
|
+
let div = Math.abs(amount);
|
|
916
|
+
if (amount > 0) value = Math.ceil(value / div) * div;
|
|
917
|
+
else value = Math.floor(value / div) * div;
|
|
918
|
+
if (value > max) value = min;
|
|
919
|
+
} else {
|
|
920
|
+
value += amount;
|
|
921
|
+
if (value < min) value = max - (min - value - 1);
|
|
922
|
+
else if (value > max) value = min + (value - max - 1);
|
|
923
|
+
}
|
|
924
|
+
return value;
|
|
925
|
+
}
|
|
926
|
+
function $2ae8fe19e7cd4af8$export$96b1d28349274637(dateTime, duration) {
|
|
927
|
+
let ms;
|
|
928
|
+
if (duration.years != null && duration.years !== 0 || duration.months != null && duration.months !== 0 || duration.days != null && duration.days !== 0) {
|
|
929
|
+
let res = $2ae8fe19e7cd4af8$export$e16d8520af44a096($1842b789961e6c21$export$b21e0b124e224484(dateTime), {
|
|
930
|
+
years: duration.years,
|
|
931
|
+
months: duration.months,
|
|
932
|
+
days: duration.days
|
|
933
|
+
});
|
|
934
|
+
// Changing the date may change the timezone offset, so we need to recompute
|
|
935
|
+
// using the 'compatible' disambiguation.
|
|
936
|
+
ms = $1842b789961e6c21$export$5107c82f94518f5c(res, dateTime.timeZone);
|
|
937
|
+
} else // Otherwise, preserve the offset of the original date.
|
|
938
|
+
ms = $1842b789961e6c21$export$bd4fb2bc8bb06fb(dateTime) - dateTime.offset;
|
|
939
|
+
// Perform time manipulation in milliseconds rather than on the original time fields to account for DST.
|
|
940
|
+
// For example, adding one hour during a DST transition may result in the hour field staying the same or
|
|
941
|
+
// skipping an hour. This results in the offset field changing value instead of the specified field.
|
|
942
|
+
ms += duration.milliseconds || 0;
|
|
943
|
+
ms += (duration.seconds || 0) * 1000;
|
|
944
|
+
ms += (duration.minutes || 0) * 60000;
|
|
945
|
+
ms += (duration.hours || 0) * 3600000;
|
|
946
|
+
let res = $1842b789961e6c21$export$1b96692a1ba042ac(ms, dateTime.timeZone);
|
|
947
|
+
return $1842b789961e6c21$export$b4a036af3fc0b032(res, dateTime.calendar);
|
|
948
|
+
}
|
|
949
|
+
function $2ae8fe19e7cd4af8$export$6814caac34ca03c7(dateTime, duration) {
|
|
950
|
+
return $2ae8fe19e7cd4af8$export$96b1d28349274637(dateTime, $2ae8fe19e7cd4af8$export$3e2544e88a25bff8(duration));
|
|
951
|
+
}
|
|
952
|
+
function $2ae8fe19e7cd4af8$export$9a297d111fc86b79(dateTime, field, amount, options) {
|
|
953
|
+
// For date fields, we want the time to remain consistent and the UTC offset to potentially change to account for DST changes.
|
|
954
|
+
// For time fields, we want the time to change by the amount given. This may result in the hour field staying the same, but the UTC
|
|
955
|
+
// offset changing in the case of a backward DST transition, or skipping an hour in the case of a forward DST transition.
|
|
956
|
+
switch(field){
|
|
957
|
+
case 'hour':
|
|
958
|
+
{
|
|
959
|
+
let min = 0;
|
|
960
|
+
let max = 23;
|
|
961
|
+
if (options?.hourCycle === 12) {
|
|
962
|
+
let isPM = dateTime.hour >= 12;
|
|
963
|
+
min = isPM ? 12 : 0;
|
|
964
|
+
max = isPM ? 23 : 11;
|
|
965
|
+
}
|
|
966
|
+
// The minimum and maximum hour may be affected by daylight saving time.
|
|
967
|
+
// For example, it might jump forward at midnight, and skip 1am.
|
|
968
|
+
// Or it might end at midnight and repeat the 11pm hour. To handle this, we get
|
|
969
|
+
// the possible absolute times for the min and max, and find the maximum range
|
|
970
|
+
// that is within the current day.
|
|
971
|
+
let plainDateTime = $1842b789961e6c21$export$b21e0b124e224484(dateTime);
|
|
972
|
+
let minDate = $1842b789961e6c21$export$b4a036af3fc0b032($2ae8fe19e7cd4af8$export$e5d5e1c1822b6e56(plainDateTime, {
|
|
973
|
+
hour: min
|
|
974
|
+
}), new $5adb4cba079e6f7b$export$80ee6245ec4f29ec());
|
|
975
|
+
let minAbsolute = [
|
|
976
|
+
$1842b789961e6c21$export$5107c82f94518f5c(minDate, dateTime.timeZone, 'earlier'),
|
|
977
|
+
$1842b789961e6c21$export$5107c82f94518f5c(minDate, dateTime.timeZone, 'later')
|
|
978
|
+
].filter((ms)=>$1842b789961e6c21$export$1b96692a1ba042ac(ms, dateTime.timeZone).day === minDate.day
|
|
979
|
+
)[0];
|
|
980
|
+
let maxDate = $1842b789961e6c21$export$b4a036af3fc0b032($2ae8fe19e7cd4af8$export$e5d5e1c1822b6e56(plainDateTime, {
|
|
981
|
+
hour: max
|
|
982
|
+
}), new $5adb4cba079e6f7b$export$80ee6245ec4f29ec());
|
|
983
|
+
let maxAbsolute = [
|
|
984
|
+
$1842b789961e6c21$export$5107c82f94518f5c(maxDate, dateTime.timeZone, 'earlier'),
|
|
985
|
+
$1842b789961e6c21$export$5107c82f94518f5c(maxDate, dateTime.timeZone, 'later')
|
|
986
|
+
].filter((ms)=>$1842b789961e6c21$export$1b96692a1ba042ac(ms, dateTime.timeZone).day === maxDate.day
|
|
987
|
+
).pop();
|
|
988
|
+
// Since hours may repeat, we need to operate on the absolute time in milliseconds.
|
|
989
|
+
// This is done in hours from the Unix epoch so that cycleValue works correctly,
|
|
990
|
+
// and then converted back to milliseconds.
|
|
991
|
+
let ms1 = $1842b789961e6c21$export$bd4fb2bc8bb06fb(dateTime) - dateTime.offset;
|
|
992
|
+
let hours = Math.floor(ms1 / $2ae8fe19e7cd4af8$var$ONE_HOUR);
|
|
993
|
+
let remainder = ms1 % $2ae8fe19e7cd4af8$var$ONE_HOUR;
|
|
994
|
+
ms1 = $2ae8fe19e7cd4af8$var$cycleValue(hours, amount, Math.floor(minAbsolute / $2ae8fe19e7cd4af8$var$ONE_HOUR), Math.floor(maxAbsolute / $2ae8fe19e7cd4af8$var$ONE_HOUR), options?.round) * $2ae8fe19e7cd4af8$var$ONE_HOUR + remainder;
|
|
995
|
+
// Now compute the new timezone offset, and convert the absolute time back to local time.
|
|
996
|
+
return $1842b789961e6c21$export$b4a036af3fc0b032($1842b789961e6c21$export$1b96692a1ba042ac(ms1, dateTime.timeZone), dateTime.calendar);
|
|
997
|
+
}
|
|
998
|
+
case 'minute':
|
|
999
|
+
case 'second':
|
|
1000
|
+
case 'millisecond':
|
|
1001
|
+
// @ts-ignore
|
|
1002
|
+
return $2ae8fe19e7cd4af8$export$dd02b3e0007dfe28(dateTime, field, amount, options);
|
|
1003
|
+
case 'era':
|
|
1004
|
+
case 'year':
|
|
1005
|
+
case 'month':
|
|
1006
|
+
case 'day':
|
|
1007
|
+
{
|
|
1008
|
+
let res = $2ae8fe19e7cd4af8$export$d52ced6badfb9a4c($1842b789961e6c21$export$b21e0b124e224484(dateTime), field, amount, options);
|
|
1009
|
+
let ms = $1842b789961e6c21$export$5107c82f94518f5c(res, dateTime.timeZone);
|
|
1010
|
+
return $1842b789961e6c21$export$b4a036af3fc0b032($1842b789961e6c21$export$1b96692a1ba042ac(ms, dateTime.timeZone), dateTime.calendar);
|
|
1011
|
+
}
|
|
1012
|
+
default:
|
|
1013
|
+
throw new Error('Unsupported field ' + field);
|
|
1014
|
+
}
|
|
648
1015
|
}
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
1016
|
+
function $2ae8fe19e7cd4af8$export$31b5430eb18be4f8(dateTime, fields, disambiguation) {
|
|
1017
|
+
// Set the date/time fields, and recompute the UTC offset to account for DST changes.
|
|
1018
|
+
// We also need to validate by converting back to a local time in case hours are skipped during forward DST transitions.
|
|
1019
|
+
let plainDateTime = $1842b789961e6c21$export$b21e0b124e224484(dateTime);
|
|
1020
|
+
let res = $2ae8fe19e7cd4af8$export$e5d5e1c1822b6e56($2ae8fe19e7cd4af8$export$adaa4cf7ef1b65be(plainDateTime, fields), fields);
|
|
1021
|
+
// If the resulting plain date time values are equal, return the original time.
|
|
1022
|
+
// We don't want to change the offset when setting the time to the same value.
|
|
1023
|
+
if (res.compare(plainDateTime) === 0) return dateTime;
|
|
1024
|
+
let ms = $1842b789961e6c21$export$5107c82f94518f5c(res, dateTime.timeZone, disambiguation);
|
|
1025
|
+
return $1842b789961e6c21$export$b4a036af3fc0b032($1842b789961e6c21$export$1b96692a1ba042ac(ms, dateTime.timeZone), dateTime.calendar);
|
|
659
1026
|
}
|
|
660
1027
|
|
|
661
|
-
exports.toDateFields = toDateFields;
|
|
662
|
-
|
|
663
|
-
function toTimeFields(date) {
|
|
664
|
-
return {
|
|
665
|
-
hour: date.hour,
|
|
666
|
-
minute: date.minute,
|
|
667
|
-
second: date.second,
|
|
668
|
-
millisecond: date.millisecond
|
|
669
|
-
};
|
|
670
|
-
}
|
|
671
1028
|
|
|
672
|
-
exports.toTimeFields = toTimeFields;
|
|
673
1029
|
|
|
674
|
-
|
|
675
|
-
let hour = 0,
|
|
676
|
-
minute = 0,
|
|
677
|
-
second = 0,
|
|
678
|
-
millisecond = 0;
|
|
1030
|
+
var $6cc7196afcc354cc$exports = {};
|
|
679
1031
|
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
1032
|
+
$parcel$export($6cc7196afcc354cc$exports, "parseTime", () => $6cc7196afcc354cc$export$c9698ec7f05a07e1);
|
|
1033
|
+
$parcel$export($6cc7196afcc354cc$exports, "parseDate", () => $6cc7196afcc354cc$export$6b862160d295c8e);
|
|
1034
|
+
$parcel$export($6cc7196afcc354cc$exports, "parseDateTime", () => $6cc7196afcc354cc$export$588937bcd60ade55);
|
|
1035
|
+
$parcel$export($6cc7196afcc354cc$exports, "parseZonedDateTime", () => $6cc7196afcc354cc$export$fd7893f06e92a6a4);
|
|
1036
|
+
$parcel$export($6cc7196afcc354cc$exports, "dateTimeToString", () => $6cc7196afcc354cc$export$4223de14708adc63);
|
|
1037
|
+
$parcel$export($6cc7196afcc354cc$exports, "parseAbsolute", () => $6cc7196afcc354cc$export$5adfdab05168c219);
|
|
1038
|
+
$parcel$export($6cc7196afcc354cc$exports, "parseAbsoluteToLocal", () => $6cc7196afcc354cc$export$8e384432362ed0f0);
|
|
1039
|
+
$parcel$export($6cc7196afcc354cc$exports, "timeToString", () => $6cc7196afcc354cc$export$f59dee82248f5ad4);
|
|
1040
|
+
$parcel$export($6cc7196afcc354cc$exports, "dateToString", () => $6cc7196afcc354cc$export$60dfd74aa96791bd);
|
|
1041
|
+
$parcel$export($6cc7196afcc354cc$exports, "zonedDateTimeToString", () => $6cc7196afcc354cc$export$bf79f1ebf4b18792);
|
|
690
1042
|
|
|
691
|
-
if (time) {
|
|
692
|
-
({
|
|
693
|
-
hour,
|
|
694
|
-
minute,
|
|
695
|
-
second,
|
|
696
|
-
millisecond
|
|
697
|
-
} = time);
|
|
698
|
-
}
|
|
699
1043
|
|
|
700
|
-
return new CalendarDateTime(date.calendar, date.era, date.year, date.month, date.day, hour, minute, second, millisecond);
|
|
701
|
-
}
|
|
702
1044
|
|
|
703
|
-
exports.toCalendarDateTime = toCalendarDateTime;
|
|
704
1045
|
|
|
705
|
-
|
|
706
|
-
|
|
1046
|
+
const $6cc7196afcc354cc$var$TIME_RE = /^(\d{2})(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?$/;
|
|
1047
|
+
const $6cc7196afcc354cc$var$DATE_RE = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
1048
|
+
const $6cc7196afcc354cc$var$DATE_TIME_RE = /^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?$/;
|
|
1049
|
+
const $6cc7196afcc354cc$var$ZONED_DATE_TIME_RE = /^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:([+-]\d{2})(?::(\d{2}))?)?\[(.*?)\]$/;
|
|
1050
|
+
const $6cc7196afcc354cc$var$ABSOLUTE_RE = /^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::(\d{2}))?)|Z)$/;
|
|
1051
|
+
function $6cc7196afcc354cc$export$c9698ec7f05a07e1(value) {
|
|
1052
|
+
let m = value.match($6cc7196afcc354cc$var$TIME_RE);
|
|
1053
|
+
if (!m) throw new Error('Invalid ISO 8601 time string: ' + value);
|
|
1054
|
+
return new $9bb5411e4ba634f9$export$680ea196effce5f($6cc7196afcc354cc$var$parseNumber(m[1], 0, 23), m[2] ? $6cc7196afcc354cc$var$parseNumber(m[2], 0, 59) : 0, m[3] ? $6cc7196afcc354cc$var$parseNumber(m[3], 0, 59) : 0, m[4] ? $6cc7196afcc354cc$var$parseNumber(m[4], 0, Infinity) * 1000 : 0);
|
|
707
1055
|
}
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
1056
|
+
function $6cc7196afcc354cc$export$6b862160d295c8e(value) {
|
|
1057
|
+
let m = value.match($6cc7196afcc354cc$var$DATE_RE);
|
|
1058
|
+
if (!m) throw new Error('Invalid ISO 8601 date string: ' + value);
|
|
1059
|
+
let date = new $9bb5411e4ba634f9$export$99faa760c7908e4f($6cc7196afcc354cc$var$parseNumber(m[1], 0, 9999), $6cc7196afcc354cc$var$parseNumber(m[2], 1, 12), 1);
|
|
1060
|
+
date.day = $6cc7196afcc354cc$var$parseNumber(m[3], 0, date.calendar.getDaysInMonth(date));
|
|
713
1061
|
return date;
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
let calendarDate = calendar.fromJulianDay(date.calendar.toJulianDay(date));
|
|
717
|
-
let copy = date.copy();
|
|
718
|
-
copy.calendar = calendar;
|
|
719
|
-
copy.era = calendarDate.era;
|
|
720
|
-
copy.year = calendarDate.year;
|
|
721
|
-
copy.month = calendarDate.month;
|
|
722
|
-
copy.day = calendarDate.day;
|
|
723
|
-
return copy;
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
exports.toCalendar = toCalendar;
|
|
727
|
-
|
|
728
|
-
function toZoned(date, timeZone, disambiguation) {
|
|
729
|
-
if (date instanceof ZonedDateTime) {
|
|
730
|
-
if (date.timeZone === timeZone) {
|
|
731
|
-
return date;
|
|
732
|
-
}
|
|
733
|
-
|
|
734
|
-
return toTimeZone(date, timeZone);
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
let ms = toAbsolute(date, timeZone, disambiguation);
|
|
738
|
-
return fromAbsolute(ms, timeZone);
|
|
739
|
-
}
|
|
740
|
-
|
|
741
|
-
exports.toZoned = toZoned;
|
|
742
|
-
|
|
743
|
-
function zonedToDate(date) {
|
|
744
|
-
let ms = epochFromDate(date) - date.offset;
|
|
745
|
-
return new Date(ms);
|
|
746
|
-
}
|
|
747
|
-
|
|
748
|
-
exports.zonedToDate = zonedToDate;
|
|
749
|
-
|
|
750
|
-
function toTimeZone(date, timeZone) {
|
|
751
|
-
let ms = epochFromDate(date) - date.offset;
|
|
752
|
-
return toCalendar(fromAbsolute(ms, timeZone), date.calendar);
|
|
753
1062
|
}
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
1063
|
+
function $6cc7196afcc354cc$export$588937bcd60ade55(value) {
|
|
1064
|
+
let m = value.match($6cc7196afcc354cc$var$DATE_TIME_RE);
|
|
1065
|
+
if (!m) throw new Error('Invalid ISO 8601 date time string: ' + value);
|
|
1066
|
+
let date = new $9bb5411e4ba634f9$export$ca871e8dbb80966f($6cc7196afcc354cc$var$parseNumber(m[1], 1, 9999), $6cc7196afcc354cc$var$parseNumber(m[2], 1, 12), 1, m[4] ? $6cc7196afcc354cc$var$parseNumber(m[4], 0, 23) : 0, m[5] ? $6cc7196afcc354cc$var$parseNumber(m[5], 0, 59) : 0, m[6] ? $6cc7196afcc354cc$var$parseNumber(m[6], 0, 59) : 0, m[7] ? $6cc7196afcc354cc$var$parseNumber(m[7], 0, Infinity) * 1000 : 0);
|
|
1067
|
+
date.day = $6cc7196afcc354cc$var$parseNumber(m[3], 0, date.calendar.getDaysInMonth(date));
|
|
1068
|
+
return date;
|
|
759
1069
|
}
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
1070
|
+
function $6cc7196afcc354cc$export$fd7893f06e92a6a4(value, disambiguation) {
|
|
1071
|
+
let m = value.match($6cc7196afcc354cc$var$ZONED_DATE_TIME_RE);
|
|
1072
|
+
if (!m) throw new Error('Invalid ISO 8601 date time string: ' + value);
|
|
1073
|
+
let date = new $9bb5411e4ba634f9$export$d3b7288e7994edea($6cc7196afcc354cc$var$parseNumber(m[1], 1, 9999), $6cc7196afcc354cc$var$parseNumber(m[2], 1, 12), 1, m[10], 0, m[4] ? $6cc7196afcc354cc$var$parseNumber(m[4], 0, 23) : 0, m[5] ? $6cc7196afcc354cc$var$parseNumber(m[5], 0, 59) : 0, m[6] ? $6cc7196afcc354cc$var$parseNumber(m[6], 0, 59) : 0, m[7] ? $6cc7196afcc354cc$var$parseNumber(m[7], 0, Infinity) * 1000 : 0);
|
|
1074
|
+
date.day = $6cc7196afcc354cc$var$parseNumber(m[3], 0, date.calendar.getDaysInMonth(date));
|
|
1075
|
+
let plainDateTime = $1842b789961e6c21$export$b21e0b124e224484(date);
|
|
1076
|
+
let ms;
|
|
1077
|
+
if (m[8]) {
|
|
1078
|
+
date.offset = $6cc7196afcc354cc$var$parseNumber(m[8], -23, 23) * 3600000 + $6cc7196afcc354cc$var$parseNumber(m[9] ?? '0', 0, 59) * 60000;
|
|
1079
|
+
ms = $1842b789961e6c21$export$bd4fb2bc8bb06fb(date) - date.offset;
|
|
1080
|
+
// Validate offset against parsed date.
|
|
1081
|
+
let absolutes = $1842b789961e6c21$export$136f38efe7caf549(plainDateTime, date.timeZone);
|
|
1082
|
+
if (!absolutes.includes(ms)) throw new Error(`Offset ${$6cc7196afcc354cc$var$offsetToString(date.offset)} is invalid for ${$6cc7196afcc354cc$export$4223de14708adc63(date)} in ${date.timeZone}`);
|
|
1083
|
+
} else // Convert to absolute and back to fix invalid times due to DST.
|
|
1084
|
+
ms = $1842b789961e6c21$export$5107c82f94518f5c($1842b789961e6c21$export$b21e0b124e224484(plainDateTime), date.timeZone, disambiguation);
|
|
1085
|
+
return $1842b789961e6c21$export$1b96692a1ba042ac(ms, date.timeZone);
|
|
1086
|
+
}
|
|
1087
|
+
function $6cc7196afcc354cc$export$5adfdab05168c219(value, timeZone) {
|
|
1088
|
+
let m = value.match($6cc7196afcc354cc$var$ABSOLUTE_RE);
|
|
1089
|
+
if (!m) throw new Error('Invalid ISO 8601 date time string: ' + value);
|
|
1090
|
+
let date = new $9bb5411e4ba634f9$export$d3b7288e7994edea($6cc7196afcc354cc$var$parseNumber(m[1], 1, 9999), $6cc7196afcc354cc$var$parseNumber(m[2], 1, 12), 1, timeZone, 0, m[4] ? $6cc7196afcc354cc$var$parseNumber(m[4], 0, 23) : 0, m[5] ? $6cc7196afcc354cc$var$parseNumber(m[5], 0, 59) : 0, m[6] ? $6cc7196afcc354cc$var$parseNumber(m[6], 0, 59) : 0, m[7] ? $6cc7196afcc354cc$var$parseNumber(m[7], 0, Infinity) * 1000 : 0);
|
|
1091
|
+
date.day = $6cc7196afcc354cc$var$parseNumber(m[3], 0, date.calendar.getDaysInMonth(date));
|
|
1092
|
+
if (m[8]) date.offset = $6cc7196afcc354cc$var$parseNumber(m[8], -23, 23) * 3600000 + $6cc7196afcc354cc$var$parseNumber(m[9] ?? '0', 0, 59) * 60000;
|
|
1093
|
+
return $1842b789961e6c21$export$538b00033cc11c75(date, timeZone);
|
|
1094
|
+
}
|
|
1095
|
+
function $6cc7196afcc354cc$export$8e384432362ed0f0(value) {
|
|
1096
|
+
return $6cc7196afcc354cc$export$5adfdab05168c219(value, $77587dc5ead8743c$export$aa8b41735afcabd2());
|
|
1097
|
+
}
|
|
1098
|
+
function $6cc7196afcc354cc$var$parseNumber(value, min, max) {
|
|
1099
|
+
let val = Number(value);
|
|
1100
|
+
if (val < min || val > max) throw new RangeError(`Value out of range: ${min} <= ${val} <= ${max}`);
|
|
1101
|
+
return val;
|
|
1102
|
+
}
|
|
1103
|
+
function $6cc7196afcc354cc$export$f59dee82248f5ad4(time) {
|
|
1104
|
+
return `${String(time.hour).padStart(2, '0')}:${String(time.minute).padStart(2, '0')}:${String(time.second).padStart(2, '0')}${time.millisecond ? String(time.millisecond / 1000).slice(1) : ''}`;
|
|
1105
|
+
}
|
|
1106
|
+
function $6cc7196afcc354cc$export$60dfd74aa96791bd(date) {
|
|
1107
|
+
let gregorianDate = $1842b789961e6c21$export$b4a036af3fc0b032(date, new $5adb4cba079e6f7b$export$80ee6245ec4f29ec());
|
|
1108
|
+
return `${String(gregorianDate.year).padStart(4, '0')}-${String(gregorianDate.month).padStart(2, '0')}-${String(gregorianDate.day).padStart(2, '0')}`;
|
|
1109
|
+
}
|
|
1110
|
+
function $6cc7196afcc354cc$export$4223de14708adc63(date) {
|
|
1111
|
+
// @ts-ignore
|
|
1112
|
+
return `${$6cc7196afcc354cc$export$60dfd74aa96791bd(date)}T${$6cc7196afcc354cc$export$f59dee82248f5ad4(date)}`;
|
|
786
1113
|
}
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
date.year += years;
|
|
1114
|
+
function $6cc7196afcc354cc$var$offsetToString(offset) {
|
|
1115
|
+
let sign = Math.sign(offset) < 0 ? '-' : '+';
|
|
1116
|
+
offset = Math.abs(offset);
|
|
1117
|
+
let offsetHours = Math.floor(offset / 3600000);
|
|
1118
|
+
let offsetMinutes = offset % 3600000 / 60000;
|
|
1119
|
+
return `${sign}${String(offsetHours).padStart(2, '0')}:${String(offsetMinutes).padStart(2, '0')}`;
|
|
794
1120
|
}
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
while (date.month < 1) {
|
|
798
|
-
$ef0e396d65262cb58648549e1b295ffb$var$addYears(date, -1);
|
|
799
|
-
date.month += date.calendar.getMonthsInYear(date);
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
let monthsInYear = 0;
|
|
803
|
-
|
|
804
|
-
while (date.month > (monthsInYear = date.calendar.getMonthsInYear(date))) {
|
|
805
|
-
date.month -= monthsInYear;
|
|
806
|
-
$ef0e396d65262cb58648549e1b295ffb$var$addYears(date, 1);
|
|
807
|
-
}
|
|
1121
|
+
function $6cc7196afcc354cc$export$bf79f1ebf4b18792(date) {
|
|
1122
|
+
return `${$6cc7196afcc354cc$export$4223de14708adc63(date)}${$6cc7196afcc354cc$var$offsetToString(date.offset)}[${date.timeZone}]`;
|
|
808
1123
|
}
|
|
809
1124
|
|
|
810
|
-
function $ef0e396d65262cb58648549e1b295ffb$var$balanceDay(date) {
|
|
811
|
-
while (date.day < 1) {
|
|
812
|
-
date.month--;
|
|
813
|
-
$ef0e396d65262cb58648549e1b295ffb$var$balanceYearMonth(date);
|
|
814
|
-
date.day += date.calendar.getDaysInMonth(date);
|
|
815
|
-
}
|
|
816
|
-
|
|
817
|
-
while (date.day > date.calendar.getDaysInMonth(date)) {
|
|
818
|
-
date.day -= date.calendar.getDaysInMonth(date);
|
|
819
|
-
date.month++;
|
|
820
|
-
$ef0e396d65262cb58648549e1b295ffb$var$balanceYearMonth(date);
|
|
821
|
-
}
|
|
822
|
-
}
|
|
823
1125
|
|
|
824
|
-
function $ef0e396d65262cb58648549e1b295ffb$var$constrainMonthDay(date) {
|
|
825
|
-
date.month = Math.max(1, Math.min(date.calendar.getMonthsInYear(date), date.month));
|
|
826
|
-
date.day = Math.max(1, Math.min(date.calendar.getDaysInMonth(date), date.day));
|
|
827
|
-
}
|
|
828
1126
|
|
|
829
|
-
function $ef0e396d65262cb58648549e1b295ffb$export$constrain(date) {
|
|
830
|
-
if (date.calendar.constrainDate) {
|
|
831
|
-
date.calendar.constrainDate(date);
|
|
832
|
-
}
|
|
833
1127
|
|
|
834
|
-
|
|
835
|
-
|
|
1128
|
+
function $9bb5411e4ba634f9$var$shiftArgs(args) {
|
|
1129
|
+
let calendar = typeof args[0] === 'object' ? args.shift() : new $5adb4cba079e6f7b$export$80ee6245ec4f29ec();
|
|
1130
|
+
let era;
|
|
1131
|
+
if (typeof args[0] === 'string') era = args.shift();
|
|
1132
|
+
else {
|
|
1133
|
+
let eras = calendar.getEras();
|
|
1134
|
+
era = eras[eras.length - 1];
|
|
1135
|
+
}
|
|
1136
|
+
let year = args.shift();
|
|
1137
|
+
let month = args.shift();
|
|
1138
|
+
let day = args.shift();
|
|
1139
|
+
return [
|
|
1140
|
+
calendar,
|
|
1141
|
+
era,
|
|
1142
|
+
year,
|
|
1143
|
+
month,
|
|
1144
|
+
day
|
|
1145
|
+
];
|
|
1146
|
+
}
|
|
1147
|
+
class $9bb5411e4ba634f9$export$99faa760c7908e4f {
|
|
1148
|
+
// This prevents TypeScript from allowing other types with the same fields to match.
|
|
1149
|
+
// i.e. a ZonedDateTime should not be be passable to a parameter that expects CalendarDate.
|
|
1150
|
+
// If that behavior is desired, use the AnyCalendarDate interface instead.
|
|
1151
|
+
#type;
|
|
1152
|
+
constructor(...args){
|
|
1153
|
+
let [calendar, era, year, month, day] = $9bb5411e4ba634f9$var$shiftArgs(args);
|
|
1154
|
+
this.calendar = calendar;
|
|
1155
|
+
this.era = era;
|
|
1156
|
+
this.year = year;
|
|
1157
|
+
this.month = month;
|
|
1158
|
+
this.day = day;
|
|
1159
|
+
$2ae8fe19e7cd4af8$export$c4e2ecac49351ef2(this);
|
|
1160
|
+
}
|
|
1161
|
+
copy() {
|
|
1162
|
+
if (this.era) return new $9bb5411e4ba634f9$export$99faa760c7908e4f(this.calendar, this.era, this.year, this.month, this.day);
|
|
1163
|
+
else return new $9bb5411e4ba634f9$export$99faa760c7908e4f(this.calendar, this.year, this.month, this.day);
|
|
1164
|
+
}
|
|
1165
|
+
add(duration) {
|
|
1166
|
+
return $2ae8fe19e7cd4af8$export$e16d8520af44a096(this, duration);
|
|
1167
|
+
}
|
|
1168
|
+
subtract(duration) {
|
|
1169
|
+
return $2ae8fe19e7cd4af8$export$4e2d2ead65e5f7e3(this, duration);
|
|
1170
|
+
}
|
|
1171
|
+
set(fields) {
|
|
1172
|
+
return $2ae8fe19e7cd4af8$export$adaa4cf7ef1b65be(this, fields);
|
|
1173
|
+
}
|
|
1174
|
+
cycle(field, amount, options) {
|
|
1175
|
+
return $2ae8fe19e7cd4af8$export$d52ced6badfb9a4c(this, field, amount, options);
|
|
1176
|
+
}
|
|
1177
|
+
toDate(timeZone) {
|
|
1178
|
+
return $1842b789961e6c21$export$e67a095c620b86fe(this, timeZone);
|
|
1179
|
+
}
|
|
1180
|
+
toString() {
|
|
1181
|
+
return $6cc7196afcc354cc$export$60dfd74aa96791bd(this);
|
|
1182
|
+
}
|
|
1183
|
+
compare(b) {
|
|
1184
|
+
return $77587dc5ead8743c$export$68781ddf31c0090f(this, b);
|
|
1185
|
+
}
|
|
836
1186
|
}
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
1187
|
+
class $9bb5411e4ba634f9$export$680ea196effce5f {
|
|
1188
|
+
// This prevents TypeScript from allowing other types with the same fields to match.
|
|
1189
|
+
#type;
|
|
1190
|
+
constructor(hour = 0, minute = 0, second = 0, millisecond = 0){
|
|
1191
|
+
this.hour = hour;
|
|
1192
|
+
this.minute = minute;
|
|
1193
|
+
this.second = second;
|
|
1194
|
+
this.millisecond = millisecond;
|
|
1195
|
+
$2ae8fe19e7cd4af8$export$7555de1e070510cb(this);
|
|
1196
|
+
}
|
|
1197
|
+
copy() {
|
|
1198
|
+
return new $9bb5411e4ba634f9$export$680ea196effce5f(this.hour, this.minute, this.second, this.millisecond);
|
|
1199
|
+
}
|
|
1200
|
+
add(duration) {
|
|
1201
|
+
return $2ae8fe19e7cd4af8$export$7ed87b6bc2506470(this, duration);
|
|
1202
|
+
}
|
|
1203
|
+
subtract(duration) {
|
|
1204
|
+
return $2ae8fe19e7cd4af8$export$fe34d3a381cd7501(this, duration);
|
|
1205
|
+
}
|
|
1206
|
+
set(fields) {
|
|
1207
|
+
return $2ae8fe19e7cd4af8$export$e5d5e1c1822b6e56(this, fields);
|
|
1208
|
+
}
|
|
1209
|
+
cycle(field, amount, options) {
|
|
1210
|
+
return $2ae8fe19e7cd4af8$export$dd02b3e0007dfe28(this, field, amount, options);
|
|
1211
|
+
}
|
|
1212
|
+
toString() {
|
|
1213
|
+
return $6cc7196afcc354cc$export$f59dee82248f5ad4(this);
|
|
1214
|
+
}
|
|
1215
|
+
compare(b) {
|
|
1216
|
+
return $77587dc5ead8743c$export$c19a80a9721b80f6(this, b);
|
|
844
1217
|
}
|
|
845
|
-
}
|
|
846
|
-
|
|
847
|
-
return inverseDuration;
|
|
848
1218
|
}
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
if (fields.month != null) {
|
|
866
|
-
mutableDate.month = fields.month;
|
|
867
|
-
}
|
|
868
|
-
|
|
869
|
-
if (fields.day != null) {
|
|
870
|
-
mutableDate.day = fields.day;
|
|
871
|
-
}
|
|
872
|
-
|
|
873
|
-
$ef0e396d65262cb58648549e1b295ffb$export$constrain(mutableDate);
|
|
874
|
-
return mutableDate;
|
|
875
|
-
}
|
|
876
|
-
|
|
877
|
-
function $ef0e396d65262cb58648549e1b295ffb$export$setTime(value, fields) {
|
|
878
|
-
let mutableValue = value.copy();
|
|
879
|
-
|
|
880
|
-
if (fields.hour != null) {
|
|
881
|
-
mutableValue.hour = fields.hour;
|
|
882
|
-
}
|
|
883
|
-
|
|
884
|
-
if (fields.minute != null) {
|
|
885
|
-
mutableValue.minute = fields.minute;
|
|
886
|
-
}
|
|
887
|
-
|
|
888
|
-
if (fields.second != null) {
|
|
889
|
-
mutableValue.second = fields.second;
|
|
890
|
-
}
|
|
891
|
-
|
|
892
|
-
if (fields.millisecond != null) {
|
|
893
|
-
mutableValue.millisecond = fields.millisecond;
|
|
894
|
-
}
|
|
895
|
-
|
|
896
|
-
$ef0e396d65262cb58648549e1b295ffb$export$constrainTime(mutableValue);
|
|
897
|
-
return mutableValue;
|
|
898
|
-
}
|
|
899
|
-
|
|
900
|
-
function $ef0e396d65262cb58648549e1b295ffb$var$balanceTime(time) {
|
|
901
|
-
time.second += Math.floor(time.millisecond / 1000);
|
|
902
|
-
time.millisecond = $ef0e396d65262cb58648549e1b295ffb$var$nonNegativeMod(time.millisecond, 1000);
|
|
903
|
-
time.minute += Math.floor(time.second / 60);
|
|
904
|
-
time.second = $ef0e396d65262cb58648549e1b295ffb$var$nonNegativeMod(time.second, 60);
|
|
905
|
-
time.hour += Math.floor(time.minute / 60);
|
|
906
|
-
time.minute = $ef0e396d65262cb58648549e1b295ffb$var$nonNegativeMod(time.minute, 60);
|
|
907
|
-
let days = Math.floor(time.hour / 24);
|
|
908
|
-
time.hour = $ef0e396d65262cb58648549e1b295ffb$var$nonNegativeMod(time.hour, 24);
|
|
909
|
-
return days;
|
|
910
|
-
}
|
|
911
|
-
|
|
912
|
-
function $ef0e396d65262cb58648549e1b295ffb$export$constrainTime(time) {
|
|
913
|
-
time.millisecond = Math.max(0, Math.min(time.millisecond, 1000));
|
|
914
|
-
time.second = Math.max(0, Math.min(time.second, 59));
|
|
915
|
-
time.minute = Math.max(0, Math.min(time.minute, 59));
|
|
916
|
-
time.hour = Math.max(0, Math.min(time.hour, 23));
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
function $ef0e396d65262cb58648549e1b295ffb$var$nonNegativeMod(a, b) {
|
|
920
|
-
let result = a % b;
|
|
921
|
-
|
|
922
|
-
if (result < 0) {
|
|
923
|
-
result += b;
|
|
924
|
-
}
|
|
925
|
-
|
|
926
|
-
return result;
|
|
927
|
-
}
|
|
928
|
-
|
|
929
|
-
function $ef0e396d65262cb58648549e1b295ffb$var$addTimeFields(time, duration) {
|
|
930
|
-
time.hour += duration.hours || 0;
|
|
931
|
-
time.minute += duration.minutes || 0;
|
|
932
|
-
time.second += duration.seconds || 0;
|
|
933
|
-
time.millisecond += duration.milliseconds || 0;
|
|
934
|
-
return $ef0e396d65262cb58648549e1b295ffb$var$balanceTime(time);
|
|
935
|
-
}
|
|
936
|
-
|
|
937
|
-
function $ef0e396d65262cb58648549e1b295ffb$export$addTime(time, duration) {
|
|
938
|
-
let res = time.copy();
|
|
939
|
-
$ef0e396d65262cb58648549e1b295ffb$var$addTimeFields(res, duration);
|
|
940
|
-
return res;
|
|
941
|
-
}
|
|
942
|
-
|
|
943
|
-
function $ef0e396d65262cb58648549e1b295ffb$export$subtractTime(time, duration) {
|
|
944
|
-
return $ef0e396d65262cb58648549e1b295ffb$export$addTime(time, $ef0e396d65262cb58648549e1b295ffb$export$invertDuration(duration));
|
|
945
|
-
}
|
|
946
|
-
|
|
947
|
-
function $ef0e396d65262cb58648549e1b295ffb$export$cycleDate(value, field, amount, options) {
|
|
948
|
-
let mutable = value.copy();
|
|
949
|
-
|
|
950
|
-
switch (field) {
|
|
951
|
-
case 'era':
|
|
952
|
-
{
|
|
953
|
-
let eras = value.calendar.getEras();
|
|
954
|
-
let eraIndex = eras.indexOf(value.era);
|
|
955
|
-
|
|
956
|
-
if (eraIndex < 0) {
|
|
957
|
-
throw new Error('Invalid era: ' + value.era);
|
|
958
|
-
}
|
|
959
|
-
|
|
960
|
-
eraIndex = $ef0e396d65262cb58648549e1b295ffb$var$cycleValue(eraIndex, amount, 0, eras.length - 1, options == null ? void 0 : options.round);
|
|
961
|
-
mutable.era = eras[eraIndex]; // Constrain the year and other fields within the era, so the era doesn't change when we balance below.
|
|
962
|
-
|
|
963
|
-
$ef0e396d65262cb58648549e1b295ffb$export$constrain(mutable);
|
|
964
|
-
break;
|
|
965
|
-
}
|
|
966
|
-
|
|
967
|
-
case 'year':
|
|
968
|
-
{
|
|
969
|
-
if (mutable.calendar.getYearsToAdd) {
|
|
970
|
-
amount = mutable.calendar.getYearsToAdd(mutable, amount);
|
|
971
|
-
} // The year field should not cycle within the era as that can cause weird behavior affecting other fields.
|
|
972
|
-
// We need to also allow values < 1 so that decrementing goes to the previous era. If we get -Infinity back
|
|
973
|
-
// we know we wrapped around after reaching 9999 (the maximum), so set the year back to 1.
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
mutable.year = $ef0e396d65262cb58648549e1b295ffb$var$cycleValue(value.year, amount, -Infinity, 9999, options == null ? void 0 : options.round);
|
|
977
|
-
|
|
978
|
-
if (mutable.year === -Infinity) {
|
|
979
|
-
mutable.year = 1;
|
|
980
|
-
}
|
|
981
|
-
|
|
982
|
-
if (mutable.calendar.balanceYearMonth) {
|
|
983
|
-
mutable.calendar.balanceYearMonth(mutable, value);
|
|
984
|
-
}
|
|
985
|
-
|
|
986
|
-
break;
|
|
987
|
-
}
|
|
988
|
-
|
|
989
|
-
case 'month':
|
|
990
|
-
mutable.month = $ef0e396d65262cb58648549e1b295ffb$var$cycleValue(value.month, amount, 1, value.calendar.getMonthsInYear(value), options == null ? void 0 : options.round);
|
|
991
|
-
break;
|
|
992
|
-
|
|
993
|
-
case 'day':
|
|
994
|
-
mutable.day = $ef0e396d65262cb58648549e1b295ffb$var$cycleValue(value.day, amount, 1, value.calendar.getDaysInMonth(value), options == null ? void 0 : options.round);
|
|
995
|
-
break;
|
|
996
|
-
|
|
997
|
-
default:
|
|
998
|
-
throw new Error('Unsupported field ' + field);
|
|
999
|
-
}
|
|
1000
|
-
|
|
1001
|
-
if (value.calendar.balanceDate) {
|
|
1002
|
-
value.calendar.balanceDate(mutable);
|
|
1003
|
-
}
|
|
1004
|
-
|
|
1005
|
-
$ef0e396d65262cb58648549e1b295ffb$export$constrain(mutable);
|
|
1006
|
-
return mutable;
|
|
1007
|
-
}
|
|
1008
|
-
|
|
1009
|
-
function $ef0e396d65262cb58648549e1b295ffb$export$cycleTime(value, field, amount, options) {
|
|
1010
|
-
let mutable = value.copy();
|
|
1011
|
-
|
|
1012
|
-
switch (field) {
|
|
1013
|
-
case 'hour':
|
|
1014
|
-
{
|
|
1015
|
-
let hours = value.hour;
|
|
1016
|
-
let min = 0;
|
|
1017
|
-
let max = 23;
|
|
1018
|
-
|
|
1019
|
-
if ((options == null ? void 0 : options.hourCycle) === 12) {
|
|
1020
|
-
let isPM = hours >= 12;
|
|
1021
|
-
min = isPM ? 12 : 0;
|
|
1022
|
-
max = isPM ? 23 : 11;
|
|
1023
|
-
}
|
|
1024
|
-
|
|
1025
|
-
mutable.hour = $ef0e396d65262cb58648549e1b295ffb$var$cycleValue(hours, amount, min, max, options == null ? void 0 : options.round);
|
|
1026
|
-
break;
|
|
1027
|
-
}
|
|
1028
|
-
|
|
1029
|
-
case 'minute':
|
|
1030
|
-
mutable.minute = $ef0e396d65262cb58648549e1b295ffb$var$cycleValue(value.minute, amount, 0, 59, options == null ? void 0 : options.round);
|
|
1031
|
-
break;
|
|
1032
|
-
|
|
1033
|
-
case 'second':
|
|
1034
|
-
mutable.second = $ef0e396d65262cb58648549e1b295ffb$var$cycleValue(value.second, amount, 0, 59, options == null ? void 0 : options.round);
|
|
1035
|
-
break;
|
|
1036
|
-
|
|
1037
|
-
case 'millisecond':
|
|
1038
|
-
mutable.millisecond = $ef0e396d65262cb58648549e1b295ffb$var$cycleValue(value.millisecond, amount, 0, 999, options == null ? void 0 : options.round);
|
|
1039
|
-
break;
|
|
1040
|
-
|
|
1041
|
-
default:
|
|
1042
|
-
throw new Error('Unsupported field ' + field);
|
|
1043
|
-
}
|
|
1044
|
-
|
|
1045
|
-
return mutable;
|
|
1046
|
-
}
|
|
1047
|
-
|
|
1048
|
-
function $ef0e396d65262cb58648549e1b295ffb$var$cycleValue(value, amount, min, max, round) {
|
|
1049
|
-
if (round === void 0) {
|
|
1050
|
-
round = false;
|
|
1051
|
-
}
|
|
1052
|
-
|
|
1053
|
-
if (round) {
|
|
1054
|
-
value += Math.sign(amount);
|
|
1055
|
-
|
|
1056
|
-
if (value < min) {
|
|
1057
|
-
value = max;
|
|
1058
|
-
}
|
|
1059
|
-
|
|
1060
|
-
let div = Math.abs(amount);
|
|
1061
|
-
|
|
1062
|
-
if (amount > 0) {
|
|
1063
|
-
value = Math.ceil(value / div) * div;
|
|
1064
|
-
} else {
|
|
1065
|
-
value = Math.floor(value / div) * div;
|
|
1066
|
-
}
|
|
1067
|
-
|
|
1068
|
-
if (value > max) {
|
|
1069
|
-
value = min;
|
|
1070
|
-
}
|
|
1071
|
-
} else {
|
|
1072
|
-
value += amount;
|
|
1073
|
-
|
|
1074
|
-
if (value < min) {
|
|
1075
|
-
value = max - (min - value - 1);
|
|
1076
|
-
} else if (value > max) {
|
|
1077
|
-
value = min + (value - max - 1);
|
|
1078
|
-
}
|
|
1079
|
-
}
|
|
1080
|
-
|
|
1081
|
-
return value;
|
|
1082
|
-
}
|
|
1083
|
-
|
|
1084
|
-
function $ef0e396d65262cb58648549e1b295ffb$export$addZoned(dateTime, duration) {
|
|
1085
|
-
let ms;
|
|
1086
|
-
|
|
1087
|
-
if (duration.years != null && duration.years !== 0 || duration.months != null && duration.months !== 0 || duration.days != null && duration.days !== 0) {
|
|
1088
|
-
let res = $ef0e396d65262cb58648549e1b295ffb$export$add(toCalendarDateTime(dateTime), {
|
|
1089
|
-
years: duration.years,
|
|
1090
|
-
months: duration.months,
|
|
1091
|
-
days: duration.days
|
|
1092
|
-
}); // Changing the date may change the timezone offset, so we need to recompute
|
|
1093
|
-
// using the 'compatible' disambiguation.
|
|
1094
|
-
|
|
1095
|
-
ms = toAbsolute(res, dateTime.timeZone);
|
|
1096
|
-
} else {
|
|
1097
|
-
// Otherwise, preserve the offset of the original date.
|
|
1098
|
-
ms = epochFromDate(dateTime) - dateTime.offset;
|
|
1099
|
-
} // Perform time manipulation in milliseconds rather than on the original time fields to account for DST.
|
|
1100
|
-
// For example, adding one hour during a DST transition may result in the hour field staying the same or
|
|
1101
|
-
// skipping an hour. This results in the offset field changing value instead of the specified field.
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
ms += duration.milliseconds || 0;
|
|
1105
|
-
ms += (duration.seconds || 0) * 1000;
|
|
1106
|
-
ms += (duration.minutes || 0) * 60 * 1000;
|
|
1107
|
-
ms += (duration.hours || 0) * 60 * 60 * 1000;
|
|
1108
|
-
let res = fromAbsolute(ms, dateTime.timeZone);
|
|
1109
|
-
return toCalendar(res, dateTime.calendar);
|
|
1110
|
-
}
|
|
1111
|
-
|
|
1112
|
-
function $ef0e396d65262cb58648549e1b295ffb$export$subtractZoned(dateTime, duration) {
|
|
1113
|
-
return $ef0e396d65262cb58648549e1b295ffb$export$addZoned(dateTime, $ef0e396d65262cb58648549e1b295ffb$export$invertDuration(duration));
|
|
1114
|
-
}
|
|
1115
|
-
|
|
1116
|
-
function $ef0e396d65262cb58648549e1b295ffb$export$cycleZoned(dateTime, field, amount, options) {
|
|
1117
|
-
// For date fields, we want the time to remain consistent and the UTC offset to potentially change to account for DST changes.
|
|
1118
|
-
// For time fields, we want the time to change by the amount given. This may result in the hour field staying the same, but the UTC
|
|
1119
|
-
// offset changing in the case of a backward DST transition, or skipping an hour in the case of a forward DST transition.
|
|
1120
|
-
switch (field) {
|
|
1121
|
-
case 'hour':
|
|
1122
|
-
{
|
|
1123
|
-
let min = 0;
|
|
1124
|
-
let max = 23;
|
|
1125
|
-
|
|
1126
|
-
if ((options == null ? void 0 : options.hourCycle) === 12) {
|
|
1127
|
-
let isPM = dateTime.hour >= 12;
|
|
1128
|
-
min = isPM ? 12 : 0;
|
|
1129
|
-
max = isPM ? 23 : 11;
|
|
1130
|
-
} // The minimum and maximum hour may be affected by daylight saving time.
|
|
1131
|
-
// For example, it might jump forward at midnight, and skip 1am.
|
|
1132
|
-
// Or it might end at midnight and repeat the 11pm hour. To handle this, we get
|
|
1133
|
-
// the possible absolute times for the min and max, and find the maximum range
|
|
1134
|
-
// that is within the current day.
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
let plainDateTime = toCalendarDateTime(dateTime);
|
|
1138
|
-
let minDate = toCalendar($ef0e396d65262cb58648549e1b295ffb$export$setTime(plainDateTime, {
|
|
1139
|
-
hour: min
|
|
1140
|
-
}), new GregorianCalendar());
|
|
1141
|
-
let minAbsolute = [toAbsolute(minDate, dateTime.timeZone, 'earlier'), toAbsolute(minDate, dateTime.timeZone, 'later')].filter(ms => fromAbsolute(ms, dateTime.timeZone).day === minDate.day)[0];
|
|
1142
|
-
let maxDate = toCalendar($ef0e396d65262cb58648549e1b295ffb$export$setTime(plainDateTime, {
|
|
1143
|
-
hour: max
|
|
1144
|
-
}), new GregorianCalendar());
|
|
1145
|
-
let maxAbsolute = [toAbsolute(maxDate, dateTime.timeZone, 'earlier'), toAbsolute(maxDate, dateTime.timeZone, 'later')].filter(ms => fromAbsolute(ms, dateTime.timeZone).day === maxDate.day).pop(); // Since hours may repeat, we need to operate on the absolute time in milliseconds.
|
|
1146
|
-
// This is done in hours from the Unix epoch so that cycleValue works correctly,
|
|
1147
|
-
// and then converted back to milliseconds.
|
|
1148
|
-
|
|
1149
|
-
let ms = epochFromDate(dateTime) - dateTime.offset;
|
|
1150
|
-
let hours = Math.floor(ms / $ef0e396d65262cb58648549e1b295ffb$var$ONE_HOUR);
|
|
1151
|
-
let remainder = ms % $ef0e396d65262cb58648549e1b295ffb$var$ONE_HOUR;
|
|
1152
|
-
ms = $ef0e396d65262cb58648549e1b295ffb$var$cycleValue(hours, amount, Math.floor(minAbsolute / $ef0e396d65262cb58648549e1b295ffb$var$ONE_HOUR), Math.floor(maxAbsolute / $ef0e396d65262cb58648549e1b295ffb$var$ONE_HOUR), options == null ? void 0 : options.round) * $ef0e396d65262cb58648549e1b295ffb$var$ONE_HOUR + remainder; // Now compute the new timezone offset, and convert the absolute time back to local time.
|
|
1153
|
-
|
|
1154
|
-
return toCalendar(fromAbsolute(ms, dateTime.timeZone), dateTime.calendar);
|
|
1155
|
-
}
|
|
1156
|
-
|
|
1157
|
-
case 'minute':
|
|
1158
|
-
case 'second':
|
|
1159
|
-
case 'millisecond':
|
|
1160
|
-
// @ts-ignore
|
|
1161
|
-
return $ef0e396d65262cb58648549e1b295ffb$export$cycleTime(dateTime, field, amount, options);
|
|
1162
|
-
|
|
1163
|
-
case 'era':
|
|
1164
|
-
case 'year':
|
|
1165
|
-
case 'month':
|
|
1166
|
-
case 'day':
|
|
1167
|
-
{
|
|
1168
|
-
let res = $ef0e396d65262cb58648549e1b295ffb$export$cycleDate(toCalendarDateTime(dateTime), field, amount, options);
|
|
1169
|
-
let ms = toAbsolute(res, dateTime.timeZone);
|
|
1170
|
-
return toCalendar(fromAbsolute(ms, dateTime.timeZone), dateTime.calendar);
|
|
1171
|
-
}
|
|
1172
|
-
|
|
1173
|
-
default:
|
|
1174
|
-
throw new Error('Unsupported field ' + field);
|
|
1175
|
-
}
|
|
1176
|
-
}
|
|
1177
|
-
|
|
1178
|
-
function $ef0e396d65262cb58648549e1b295ffb$export$setZoned(dateTime, fields, disambiguation) {
|
|
1179
|
-
// Set the date/time fields, and recompute the UTC offset to account for DST changes.
|
|
1180
|
-
// We also need to validate by converting back to a local time in case hours are skipped during forward DST transitions.
|
|
1181
|
-
let plainDateTime = toCalendarDateTime(dateTime);
|
|
1182
|
-
let res = $ef0e396d65262cb58648549e1b295ffb$export$setTime($ef0e396d65262cb58648549e1b295ffb$export$set(plainDateTime, fields), fields); // If the resulting plain date time values are equal, return the original time.
|
|
1183
|
-
// We don't want to change the offset when setting the time to the same value.
|
|
1184
|
-
|
|
1185
|
-
if (res.compare(plainDateTime) === 0) {
|
|
1186
|
-
return dateTime;
|
|
1187
|
-
}
|
|
1188
|
-
|
|
1189
|
-
let ms = toAbsolute(res, dateTime.timeZone, disambiguation);
|
|
1190
|
-
return toCalendar(fromAbsolute(ms, dateTime.timeZone), dateTime.calendar);
|
|
1191
|
-
}
|
|
1192
|
-
|
|
1193
|
-
const $bd6bf09705eeaa0793e81f11d$var$TIME_RE = /^(\d{2})(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?$/;
|
|
1194
|
-
const $bd6bf09705eeaa0793e81f11d$var$DATE_RE = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
1195
|
-
const $bd6bf09705eeaa0793e81f11d$var$DATE_TIME_RE = /^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?$/;
|
|
1196
|
-
const $bd6bf09705eeaa0793e81f11d$var$ZONED_DATE_TIME_RE = /^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:([+-]\d{2})(?::(\d{2}))?)?\[(.*?)\]$/;
|
|
1197
|
-
const $bd6bf09705eeaa0793e81f11d$var$ABSOLUTE_RE = /^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::(\d{2}))?)|Z)$/;
|
|
1198
|
-
|
|
1199
|
-
function parseTime(value) {
|
|
1200
|
-
let m = value.match($bd6bf09705eeaa0793e81f11d$var$TIME_RE);
|
|
1201
|
-
|
|
1202
|
-
if (!m) {
|
|
1203
|
-
throw new Error('Invalid ISO 8601 time string: ' + value);
|
|
1204
|
-
}
|
|
1205
|
-
|
|
1206
|
-
return new Time($bd6bf09705eeaa0793e81f11d$var$parseNumber(m[1], 0, 23), m[2] ? $bd6bf09705eeaa0793e81f11d$var$parseNumber(m[2], 0, 59) : 0, m[3] ? $bd6bf09705eeaa0793e81f11d$var$parseNumber(m[3], 0, 59) : 0, m[4] ? $bd6bf09705eeaa0793e81f11d$var$parseNumber(m[4], 0, Infinity) * 1000 : 0);
|
|
1207
|
-
}
|
|
1208
|
-
|
|
1209
|
-
exports.parseTime = parseTime;
|
|
1210
|
-
|
|
1211
|
-
function parseDate(value) {
|
|
1212
|
-
let m = value.match($bd6bf09705eeaa0793e81f11d$var$DATE_RE);
|
|
1213
|
-
|
|
1214
|
-
if (!m) {
|
|
1215
|
-
throw new Error('Invalid ISO 8601 date string: ' + value);
|
|
1216
|
-
}
|
|
1217
|
-
|
|
1218
|
-
let date = new CalendarDate($bd6bf09705eeaa0793e81f11d$var$parseNumber(m[1], 0, 9999), $bd6bf09705eeaa0793e81f11d$var$parseNumber(m[2], 1, 12), 1);
|
|
1219
|
-
date.day = $bd6bf09705eeaa0793e81f11d$var$parseNumber(m[3], 0, date.calendar.getDaysInMonth(date));
|
|
1220
|
-
return date;
|
|
1221
|
-
}
|
|
1222
|
-
|
|
1223
|
-
exports.parseDate = parseDate;
|
|
1224
|
-
|
|
1225
|
-
function parseDateTime(value) {
|
|
1226
|
-
let m = value.match($bd6bf09705eeaa0793e81f11d$var$DATE_TIME_RE);
|
|
1227
|
-
|
|
1228
|
-
if (!m) {
|
|
1229
|
-
throw new Error('Invalid ISO 8601 date time string: ' + value);
|
|
1230
|
-
}
|
|
1231
|
-
|
|
1232
|
-
let date = new CalendarDateTime($bd6bf09705eeaa0793e81f11d$var$parseNumber(m[1], 1, 9999), $bd6bf09705eeaa0793e81f11d$var$parseNumber(m[2], 1, 12), 1, m[4] ? $bd6bf09705eeaa0793e81f11d$var$parseNumber(m[4], 0, 23) : 0, m[5] ? $bd6bf09705eeaa0793e81f11d$var$parseNumber(m[5], 0, 59) : 0, m[6] ? $bd6bf09705eeaa0793e81f11d$var$parseNumber(m[6], 0, 59) : 0, m[7] ? $bd6bf09705eeaa0793e81f11d$var$parseNumber(m[7], 0, Infinity) * 1000 : 0);
|
|
1233
|
-
date.day = $bd6bf09705eeaa0793e81f11d$var$parseNumber(m[3], 0, date.calendar.getDaysInMonth(date));
|
|
1234
|
-
return date;
|
|
1235
|
-
}
|
|
1236
|
-
|
|
1237
|
-
exports.parseDateTime = parseDateTime;
|
|
1238
|
-
|
|
1239
|
-
function parseZonedDateTime(value, disambiguation) {
|
|
1240
|
-
let m = value.match($bd6bf09705eeaa0793e81f11d$var$ZONED_DATE_TIME_RE);
|
|
1241
|
-
|
|
1242
|
-
if (!m) {
|
|
1243
|
-
throw new Error('Invalid ISO 8601 date time string: ' + value);
|
|
1244
|
-
}
|
|
1245
|
-
|
|
1246
|
-
let date = new ZonedDateTime($bd6bf09705eeaa0793e81f11d$var$parseNumber(m[1], 1, 9999), $bd6bf09705eeaa0793e81f11d$var$parseNumber(m[2], 1, 12), 1, m[10], 0, m[4] ? $bd6bf09705eeaa0793e81f11d$var$parseNumber(m[4], 0, 23) : 0, m[5] ? $bd6bf09705eeaa0793e81f11d$var$parseNumber(m[5], 0, 59) : 0, m[6] ? $bd6bf09705eeaa0793e81f11d$var$parseNumber(m[6], 0, 59) : 0, m[7] ? $bd6bf09705eeaa0793e81f11d$var$parseNumber(m[7], 0, Infinity) * 1000 : 0);
|
|
1247
|
-
date.day = $bd6bf09705eeaa0793e81f11d$var$parseNumber(m[3], 0, date.calendar.getDaysInMonth(date));
|
|
1248
|
-
let plainDateTime = toCalendarDateTime(date);
|
|
1249
|
-
let ms;
|
|
1250
|
-
|
|
1251
|
-
if (m[8]) {
|
|
1252
|
-
var _m$;
|
|
1253
|
-
|
|
1254
|
-
date.offset = $bd6bf09705eeaa0793e81f11d$var$parseNumber(m[8], -23, 23) * 60 * 60 * 1000 + $bd6bf09705eeaa0793e81f11d$var$parseNumber((_m$ = m[9]) != null ? _m$ : '0', 0, 59) * 60 * 1000;
|
|
1255
|
-
ms = epochFromDate(date) - date.offset; // Validate offset against parsed date.
|
|
1256
|
-
|
|
1257
|
-
let absolutes = possibleAbsolutes(plainDateTime, date.timeZone);
|
|
1258
|
-
|
|
1259
|
-
if (!absolutes.includes(ms)) {
|
|
1260
|
-
throw new Error("Offset " + $bd6bf09705eeaa0793e81f11d$var$offsetToString(date.offset) + " is invalid for " + dateTimeToString(date) + " in " + date.timeZone);
|
|
1219
|
+
class $9bb5411e4ba634f9$export$ca871e8dbb80966f {
|
|
1220
|
+
// This prevents TypeScript from allowing other types with the same fields to match.
|
|
1221
|
+
#type;
|
|
1222
|
+
constructor(...args){
|
|
1223
|
+
let [calendar, era, year, month, day] = $9bb5411e4ba634f9$var$shiftArgs(args);
|
|
1224
|
+
this.calendar = calendar;
|
|
1225
|
+
this.era = era;
|
|
1226
|
+
this.year = year;
|
|
1227
|
+
this.month = month;
|
|
1228
|
+
this.day = day;
|
|
1229
|
+
this.hour = args.shift() || 0;
|
|
1230
|
+
this.minute = args.shift() || 0;
|
|
1231
|
+
this.second = args.shift() || 0;
|
|
1232
|
+
this.millisecond = args.shift() || 0;
|
|
1233
|
+
$2ae8fe19e7cd4af8$export$c4e2ecac49351ef2(this);
|
|
1261
1234
|
}
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
}
|
|
1266
|
-
|
|
1267
|
-
return fromAbsolute(ms, date.timeZone);
|
|
1268
|
-
}
|
|
1269
|
-
|
|
1270
|
-
exports.parseZonedDateTime = parseZonedDateTime;
|
|
1271
|
-
|
|
1272
|
-
function parseAbsolute(value, timeZone) {
|
|
1273
|
-
let m = value.match($bd6bf09705eeaa0793e81f11d$var$ABSOLUTE_RE);
|
|
1274
|
-
|
|
1275
|
-
if (!m) {
|
|
1276
|
-
throw new Error('Invalid ISO 8601 date time string: ' + value);
|
|
1277
|
-
}
|
|
1278
|
-
|
|
1279
|
-
let date = new ZonedDateTime($bd6bf09705eeaa0793e81f11d$var$parseNumber(m[1], 1, 9999), $bd6bf09705eeaa0793e81f11d$var$parseNumber(m[2], 1, 12), 1, timeZone, 0, m[4] ? $bd6bf09705eeaa0793e81f11d$var$parseNumber(m[4], 0, 23) : 0, m[5] ? $bd6bf09705eeaa0793e81f11d$var$parseNumber(m[5], 0, 59) : 0, m[6] ? $bd6bf09705eeaa0793e81f11d$var$parseNumber(m[6], 0, 59) : 0, m[7] ? $bd6bf09705eeaa0793e81f11d$var$parseNumber(m[7], 0, Infinity) * 1000 : 0);
|
|
1280
|
-
date.day = $bd6bf09705eeaa0793e81f11d$var$parseNumber(m[3], 0, date.calendar.getDaysInMonth(date));
|
|
1281
|
-
|
|
1282
|
-
if (m[8]) {
|
|
1283
|
-
var _m$2;
|
|
1284
|
-
|
|
1285
|
-
date.offset = $bd6bf09705eeaa0793e81f11d$var$parseNumber(m[8], -23, 23) * 60 * 60 * 1000 + $bd6bf09705eeaa0793e81f11d$var$parseNumber((_m$2 = m[9]) != null ? _m$2 : '0', 0, 59) * 60 * 1000;
|
|
1286
|
-
}
|
|
1287
|
-
|
|
1288
|
-
return toTimeZone(date, timeZone);
|
|
1289
|
-
}
|
|
1290
|
-
|
|
1291
|
-
exports.parseAbsolute = parseAbsolute;
|
|
1292
|
-
|
|
1293
|
-
function parseAbsoluteToLocal(value) {
|
|
1294
|
-
return parseAbsolute(value, getLocalTimeZone());
|
|
1295
|
-
}
|
|
1296
|
-
|
|
1297
|
-
exports.parseAbsoluteToLocal = parseAbsoluteToLocal;
|
|
1298
|
-
|
|
1299
|
-
function $bd6bf09705eeaa0793e81f11d$var$parseNumber(value, min, max) {
|
|
1300
|
-
let val = Number(value);
|
|
1301
|
-
|
|
1302
|
-
if (val < min || val > max) {
|
|
1303
|
-
throw new RangeError("Value out of range: " + min + " <= " + val + " <= " + max);
|
|
1304
|
-
}
|
|
1305
|
-
|
|
1306
|
-
return val;
|
|
1307
|
-
}
|
|
1308
|
-
|
|
1309
|
-
function timeToString(time) {
|
|
1310
|
-
return String(time.hour).padStart(2, '0') + ":" + String(time.minute).padStart(2, '0') + ":" + String(time.second).padStart(2, '0') + (time.millisecond ? String(time.millisecond / 1000).slice(1) : '');
|
|
1311
|
-
}
|
|
1312
|
-
|
|
1313
|
-
exports.timeToString = timeToString;
|
|
1314
|
-
|
|
1315
|
-
function dateToString(date) {
|
|
1316
|
-
let gregorianDate = toCalendar(date, new GregorianCalendar());
|
|
1317
|
-
return String(gregorianDate.year).padStart(4, '0') + "-" + String(gregorianDate.month).padStart(2, '0') + "-" + String(gregorianDate.day).padStart(2, '0');
|
|
1318
|
-
}
|
|
1319
|
-
|
|
1320
|
-
exports.dateToString = dateToString;
|
|
1321
|
-
|
|
1322
|
-
function dateTimeToString(date) {
|
|
1323
|
-
// @ts-ignore
|
|
1324
|
-
return dateToString(date) + "T" + timeToString(date);
|
|
1325
|
-
}
|
|
1326
|
-
|
|
1327
|
-
exports.dateTimeToString = dateTimeToString;
|
|
1328
|
-
|
|
1329
|
-
function $bd6bf09705eeaa0793e81f11d$var$offsetToString(offset) {
|
|
1330
|
-
let sign = Math.sign(offset) < 0 ? '-' : '+';
|
|
1331
|
-
offset = Math.abs(offset);
|
|
1332
|
-
let offsetHours = Math.floor(offset / (60 * 60 * 1000));
|
|
1333
|
-
let offsetMinutes = offset % (60 * 60 * 1000) / (60 * 1000);
|
|
1334
|
-
return "" + sign + String(offsetHours).padStart(2, '0') + ":" + String(offsetMinutes).padStart(2, '0');
|
|
1335
|
-
}
|
|
1336
|
-
|
|
1337
|
-
function zonedDateTimeToString(date) {
|
|
1338
|
-
return "" + dateTimeToString(date) + $bd6bf09705eeaa0793e81f11d$var$offsetToString(date.offset) + "[" + date.timeZone + "]";
|
|
1339
|
-
}
|
|
1340
|
-
|
|
1341
|
-
exports.zonedDateTimeToString = zonedDateTimeToString;
|
|
1342
|
-
|
|
1343
|
-
function $d62182d5b5773c92a3ef2afcb06ab$var$shiftArgs(args) {
|
|
1344
|
-
let calendar = typeof args[0] === 'object' ? args.shift() : new GregorianCalendar();
|
|
1345
|
-
let era;
|
|
1346
|
-
|
|
1347
|
-
if (typeof args[0] === 'string') {
|
|
1348
|
-
era = args.shift();
|
|
1349
|
-
} else {
|
|
1350
|
-
let eras = calendar.getEras();
|
|
1351
|
-
era = eras[eras.length - 1];
|
|
1352
|
-
}
|
|
1353
|
-
|
|
1354
|
-
let year = args.shift();
|
|
1355
|
-
let month = args.shift();
|
|
1356
|
-
let day = args.shift();
|
|
1357
|
-
return [calendar, era, year, month, day];
|
|
1358
|
-
}
|
|
1359
|
-
|
|
1360
|
-
var $d62182d5b5773c92a3ef2afcb06ab$var$_type = _babelRuntimeHelpersClassPrivateFieldLooseKey("type");
|
|
1361
|
-
|
|
1362
|
-
class CalendarDate {
|
|
1363
|
-
// This prevents TypeScript from allowing other types with the same fields to match.
|
|
1364
|
-
// i.e. a ZonedDateTime should not be be passable to a parameter that expects CalendarDate.
|
|
1365
|
-
// If that behavior is desired, use the AnyCalendarDate interface instead.
|
|
1366
|
-
constructor() {
|
|
1367
|
-
Object.defineProperty(this, $d62182d5b5773c92a3ef2afcb06ab$var$_type, {
|
|
1368
|
-
writable: true,
|
|
1369
|
-
value: void 0
|
|
1370
|
-
});
|
|
1371
|
-
this.calendar = void 0;
|
|
1372
|
-
this.era = void 0;
|
|
1373
|
-
this.year = void 0;
|
|
1374
|
-
this.month = void 0;
|
|
1375
|
-
this.day = void 0;
|
|
1376
|
-
|
|
1377
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1378
|
-
args[_key] = arguments[_key];
|
|
1379
|
-
}
|
|
1380
|
-
|
|
1381
|
-
let [calendar, era, year, month, day] = $d62182d5b5773c92a3ef2afcb06ab$var$shiftArgs(args);
|
|
1382
|
-
this.calendar = calendar;
|
|
1383
|
-
this.era = era;
|
|
1384
|
-
this.year = year;
|
|
1385
|
-
this.month = month;
|
|
1386
|
-
this.day = day;
|
|
1387
|
-
$ef0e396d65262cb58648549e1b295ffb$export$constrain(this);
|
|
1388
|
-
}
|
|
1389
|
-
|
|
1390
|
-
copy() {
|
|
1391
|
-
if (this.era) {
|
|
1392
|
-
return new CalendarDate(this.calendar, this.era, this.year, this.month, this.day);
|
|
1393
|
-
} else {
|
|
1394
|
-
return new CalendarDate(this.calendar, this.year, this.month, this.day);
|
|
1235
|
+
copy() {
|
|
1236
|
+
if (this.era) return new $9bb5411e4ba634f9$export$ca871e8dbb80966f(this.calendar, this.era, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond);
|
|
1237
|
+
else return new $9bb5411e4ba634f9$export$ca871e8dbb80966f(this.calendar, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond);
|
|
1395
1238
|
}
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
add(duration) {
|
|
1399
|
-
return $ef0e396d65262cb58648549e1b295ffb$export$add(this, duration);
|
|
1400
|
-
}
|
|
1401
|
-
|
|
1402
|
-
subtract(duration) {
|
|
1403
|
-
return $ef0e396d65262cb58648549e1b295ffb$export$subtract(this, duration);
|
|
1404
|
-
}
|
|
1405
|
-
|
|
1406
|
-
set(fields) {
|
|
1407
|
-
return $ef0e396d65262cb58648549e1b295ffb$export$set(this, fields);
|
|
1408
|
-
}
|
|
1409
|
-
|
|
1410
|
-
cycle(field, amount, options) {
|
|
1411
|
-
return $ef0e396d65262cb58648549e1b295ffb$export$cycleDate(this, field, amount, options);
|
|
1412
|
-
}
|
|
1413
|
-
|
|
1414
|
-
toDate(timeZone) {
|
|
1415
|
-
return toDate(this, timeZone);
|
|
1416
|
-
}
|
|
1417
|
-
|
|
1418
|
-
toString() {
|
|
1419
|
-
return dateToString(this);
|
|
1420
|
-
}
|
|
1421
|
-
|
|
1422
|
-
compare(b) {
|
|
1423
|
-
return compareDate(this, b);
|
|
1424
|
-
}
|
|
1425
|
-
|
|
1426
|
-
}
|
|
1427
|
-
|
|
1428
|
-
exports.CalendarDate = CalendarDate;
|
|
1429
|
-
|
|
1430
|
-
var $d62182d5b5773c92a3ef2afcb06ab$var$_type2 = _babelRuntimeHelpersClassPrivateFieldLooseKey("type");
|
|
1431
|
-
|
|
1432
|
-
class Time {
|
|
1433
|
-
// This prevents TypeScript from allowing other types with the same fields to match.
|
|
1434
|
-
constructor(hour = 0, minute = 0, second = 0, millisecond = 0) {
|
|
1435
|
-
this.hour = hour;
|
|
1436
|
-
this.minute = minute;
|
|
1437
|
-
this.second = second;
|
|
1438
|
-
this.millisecond = millisecond;
|
|
1439
|
-
Object.defineProperty(this, $d62182d5b5773c92a3ef2afcb06ab$var$_type2, {
|
|
1440
|
-
writable: true,
|
|
1441
|
-
value: void 0
|
|
1442
|
-
});
|
|
1443
|
-
$ef0e396d65262cb58648549e1b295ffb$export$constrainTime(this);
|
|
1444
|
-
}
|
|
1445
|
-
|
|
1446
|
-
copy() {
|
|
1447
|
-
return new Time(this.hour, this.minute, this.second, this.millisecond);
|
|
1448
|
-
}
|
|
1449
|
-
|
|
1450
|
-
add(duration) {
|
|
1451
|
-
return $ef0e396d65262cb58648549e1b295ffb$export$addTime(this, duration);
|
|
1452
|
-
}
|
|
1453
|
-
|
|
1454
|
-
subtract(duration) {
|
|
1455
|
-
return $ef0e396d65262cb58648549e1b295ffb$export$subtractTime(this, duration);
|
|
1456
|
-
}
|
|
1457
|
-
|
|
1458
|
-
set(fields) {
|
|
1459
|
-
return $ef0e396d65262cb58648549e1b295ffb$export$setTime(this, fields);
|
|
1460
|
-
}
|
|
1461
|
-
|
|
1462
|
-
cycle(field, amount, options) {
|
|
1463
|
-
return $ef0e396d65262cb58648549e1b295ffb$export$cycleTime(this, field, amount, options);
|
|
1464
|
-
}
|
|
1465
|
-
|
|
1466
|
-
toString() {
|
|
1467
|
-
return timeToString(this);
|
|
1468
|
-
}
|
|
1469
|
-
|
|
1470
|
-
compare(b) {
|
|
1471
|
-
return compareTime(this, b);
|
|
1472
|
-
}
|
|
1473
|
-
|
|
1474
|
-
}
|
|
1475
|
-
|
|
1476
|
-
exports.Time = Time;
|
|
1477
|
-
|
|
1478
|
-
var $d62182d5b5773c92a3ef2afcb06ab$var$_type3 = _babelRuntimeHelpersClassPrivateFieldLooseKey("type");
|
|
1479
|
-
|
|
1480
|
-
class CalendarDateTime {
|
|
1481
|
-
// This prevents TypeScript from allowing other types with the same fields to match.
|
|
1482
|
-
constructor() {
|
|
1483
|
-
Object.defineProperty(this, $d62182d5b5773c92a3ef2afcb06ab$var$_type3, {
|
|
1484
|
-
writable: true,
|
|
1485
|
-
value: void 0
|
|
1486
|
-
});
|
|
1487
|
-
this.calendar = void 0;
|
|
1488
|
-
this.era = void 0;
|
|
1489
|
-
this.year = void 0;
|
|
1490
|
-
this.month = void 0;
|
|
1491
|
-
this.day = void 0;
|
|
1492
|
-
this.hour = void 0;
|
|
1493
|
-
this.minute = void 0;
|
|
1494
|
-
this.second = void 0;
|
|
1495
|
-
this.millisecond = void 0;
|
|
1496
|
-
|
|
1497
|
-
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
1498
|
-
args[_key2] = arguments[_key2];
|
|
1499
|
-
}
|
|
1500
|
-
|
|
1501
|
-
let [calendar, era, year, month, day] = $d62182d5b5773c92a3ef2afcb06ab$var$shiftArgs(args);
|
|
1502
|
-
this.calendar = calendar;
|
|
1503
|
-
this.era = era;
|
|
1504
|
-
this.year = year;
|
|
1505
|
-
this.month = month;
|
|
1506
|
-
this.day = day;
|
|
1507
|
-
this.hour = args.shift() || 0;
|
|
1508
|
-
this.minute = args.shift() || 0;
|
|
1509
|
-
this.second = args.shift() || 0;
|
|
1510
|
-
this.millisecond = args.shift() || 0;
|
|
1511
|
-
$ef0e396d65262cb58648549e1b295ffb$export$constrain(this);
|
|
1512
|
-
}
|
|
1513
|
-
|
|
1514
|
-
copy() {
|
|
1515
|
-
if (this.era) {
|
|
1516
|
-
return new CalendarDateTime(this.calendar, this.era, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond);
|
|
1517
|
-
} else {
|
|
1518
|
-
return new CalendarDateTime(this.calendar, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond);
|
|
1239
|
+
add(duration) {
|
|
1240
|
+
return $2ae8fe19e7cd4af8$export$e16d8520af44a096(this, duration);
|
|
1519
1241
|
}
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
add(duration) {
|
|
1523
|
-
return $ef0e396d65262cb58648549e1b295ffb$export$add(this, duration);
|
|
1524
|
-
}
|
|
1525
|
-
|
|
1526
|
-
subtract(duration) {
|
|
1527
|
-
return $ef0e396d65262cb58648549e1b295ffb$export$subtract(this, duration);
|
|
1528
|
-
}
|
|
1529
|
-
|
|
1530
|
-
set(fields) {
|
|
1531
|
-
return $ef0e396d65262cb58648549e1b295ffb$export$set($ef0e396d65262cb58648549e1b295ffb$export$setTime(this, fields), fields);
|
|
1532
|
-
}
|
|
1533
|
-
|
|
1534
|
-
cycle(field, amount, options) {
|
|
1535
|
-
switch (field) {
|
|
1536
|
-
case 'era':
|
|
1537
|
-
case 'year':
|
|
1538
|
-
case 'month':
|
|
1539
|
-
case 'day':
|
|
1540
|
-
return $ef0e396d65262cb58648549e1b295ffb$export$cycleDate(this, field, amount, options);
|
|
1541
|
-
|
|
1542
|
-
default:
|
|
1543
|
-
return $ef0e396d65262cb58648549e1b295ffb$export$cycleTime(this, field, amount, options);
|
|
1242
|
+
subtract(duration) {
|
|
1243
|
+
return $2ae8fe19e7cd4af8$export$4e2d2ead65e5f7e3(this, duration);
|
|
1544
1244
|
}
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1245
|
+
set(fields) {
|
|
1246
|
+
return $2ae8fe19e7cd4af8$export$adaa4cf7ef1b65be($2ae8fe19e7cd4af8$export$e5d5e1c1822b6e56(this, fields), fields);
|
|
1247
|
+
}
|
|
1248
|
+
cycle(field, amount, options) {
|
|
1249
|
+
switch(field){
|
|
1250
|
+
case 'era':
|
|
1251
|
+
case 'year':
|
|
1252
|
+
case 'month':
|
|
1253
|
+
case 'day':
|
|
1254
|
+
return $2ae8fe19e7cd4af8$export$d52ced6badfb9a4c(this, field, amount, options);
|
|
1255
|
+
default:
|
|
1256
|
+
return $2ae8fe19e7cd4af8$export$dd02b3e0007dfe28(this, field, amount, options);
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
toDate(timeZone) {
|
|
1260
|
+
return $1842b789961e6c21$export$e67a095c620b86fe(this, timeZone);
|
|
1261
|
+
}
|
|
1262
|
+
toString() {
|
|
1263
|
+
return $6cc7196afcc354cc$export$4223de14708adc63(this);
|
|
1264
|
+
}
|
|
1265
|
+
compare(b) {
|
|
1266
|
+
let res = $77587dc5ead8743c$export$68781ddf31c0090f(this, b);
|
|
1267
|
+
if (res === 0) return $77587dc5ead8743c$export$c19a80a9721b80f6(this, $1842b789961e6c21$export$b21e0b124e224484(b));
|
|
1268
|
+
return res;
|
|
1560
1269
|
}
|
|
1561
|
-
|
|
1562
|
-
return res;
|
|
1563
|
-
}
|
|
1564
|
-
|
|
1565
|
-
}
|
|
1566
|
-
|
|
1567
|
-
exports.CalendarDateTime = CalendarDateTime;
|
|
1568
|
-
|
|
1569
|
-
var $d62182d5b5773c92a3ef2afcb06ab$var$_type4 = _babelRuntimeHelpersClassPrivateFieldLooseKey("type");
|
|
1570
|
-
|
|
1571
|
-
class ZonedDateTime {
|
|
1572
|
-
// This prevents TypeScript from allowing other types with the same fields to match.
|
|
1573
|
-
constructor() {
|
|
1574
|
-
Object.defineProperty(this, $d62182d5b5773c92a3ef2afcb06ab$var$_type4, {
|
|
1575
|
-
writable: true,
|
|
1576
|
-
value: void 0
|
|
1577
|
-
});
|
|
1578
|
-
this.calendar = void 0;
|
|
1579
|
-
this.era = void 0;
|
|
1580
|
-
this.year = void 0;
|
|
1581
|
-
this.month = void 0;
|
|
1582
|
-
this.day = void 0;
|
|
1583
|
-
this.hour = void 0;
|
|
1584
|
-
this.minute = void 0;
|
|
1585
|
-
this.second = void 0;
|
|
1586
|
-
this.millisecond = void 0;
|
|
1587
|
-
this.timeZone = void 0;
|
|
1588
|
-
this.offset = void 0;
|
|
1589
|
-
|
|
1590
|
-
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
1591
|
-
args[_key3] = arguments[_key3];
|
|
1592
|
-
}
|
|
1593
|
-
|
|
1594
|
-
let [calendar, era, year, month, day] = $d62182d5b5773c92a3ef2afcb06ab$var$shiftArgs(args);
|
|
1595
|
-
let timeZone = args.shift();
|
|
1596
|
-
let offset = args.shift();
|
|
1597
|
-
this.calendar = calendar;
|
|
1598
|
-
this.era = era;
|
|
1599
|
-
this.year = year;
|
|
1600
|
-
this.month = month;
|
|
1601
|
-
this.day = day;
|
|
1602
|
-
this.timeZone = timeZone;
|
|
1603
|
-
this.offset = offset;
|
|
1604
|
-
this.hour = args.shift() || 0;
|
|
1605
|
-
this.minute = args.shift() || 0;
|
|
1606
|
-
this.second = args.shift() || 0;
|
|
1607
|
-
this.millisecond = args.shift() || 0;
|
|
1608
|
-
$ef0e396d65262cb58648549e1b295ffb$export$constrain(this);
|
|
1609
|
-
}
|
|
1610
|
-
|
|
1611
|
-
copy() {
|
|
1612
|
-
if (this.era) {
|
|
1613
|
-
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);
|
|
1614
|
-
} else {
|
|
1615
|
-
return new ZonedDateTime(this.calendar, this.year, this.month, this.day, this.timeZone, this.offset, this.hour, this.minute, this.second, this.millisecond);
|
|
1616
|
-
}
|
|
1617
|
-
}
|
|
1618
|
-
|
|
1619
|
-
add(duration) {
|
|
1620
|
-
return $ef0e396d65262cb58648549e1b295ffb$export$addZoned(this, duration);
|
|
1621
|
-
}
|
|
1622
|
-
|
|
1623
|
-
subtract(duration) {
|
|
1624
|
-
return $ef0e396d65262cb58648549e1b295ffb$export$subtractZoned(this, duration);
|
|
1625
|
-
}
|
|
1626
|
-
|
|
1627
|
-
set(fields, disambiguation) {
|
|
1628
|
-
return $ef0e396d65262cb58648549e1b295ffb$export$setZoned(this, fields, disambiguation);
|
|
1629
|
-
}
|
|
1630
|
-
|
|
1631
|
-
cycle(field, amount, options) {
|
|
1632
|
-
return $ef0e396d65262cb58648549e1b295ffb$export$cycleZoned(this, field, amount, options);
|
|
1633
|
-
}
|
|
1634
|
-
|
|
1635
|
-
toDate() {
|
|
1636
|
-
return zonedToDate(this);
|
|
1637
|
-
}
|
|
1638
|
-
|
|
1639
|
-
toString() {
|
|
1640
|
-
return zonedDateTimeToString(this);
|
|
1641
|
-
}
|
|
1642
|
-
|
|
1643
|
-
toAbsoluteString() {
|
|
1644
|
-
return this.toDate().toISOString();
|
|
1645
|
-
}
|
|
1646
|
-
|
|
1647
|
-
compare(b) {
|
|
1648
|
-
// TODO: Is this a bad idea??
|
|
1649
|
-
return this.toDate().getTime() - toZoned(b, this.timeZone).toDate().getTime();
|
|
1650
|
-
}
|
|
1651
|
-
|
|
1652
|
-
}
|
|
1653
|
-
|
|
1654
|
-
exports.ZonedDateTime = ZonedDateTime;
|
|
1655
|
-
const $d3cec079d200a848225dc29b5c644d27$var$ERA_START_DATES = [[1868, 9, 8], [1912, 7, 30], [1926, 12, 25], [1989, 1, 8], [2019, 5, 1]];
|
|
1656
|
-
const $d3cec079d200a848225dc29b5c644d27$var$ERA_END_DATES = [[1912, 7, 29], [1926, 12, 24], [1989, 1, 7], [2019, 4, 30]];
|
|
1657
|
-
const $d3cec079d200a848225dc29b5c644d27$var$ERA_ADDENDS = [1867, 1911, 1925, 1988, 2018];
|
|
1658
|
-
const $d3cec079d200a848225dc29b5c644d27$var$ERA_NAMES = ['meiji', 'taisho', 'showa', 'heisei', 'reiwa'];
|
|
1659
|
-
|
|
1660
|
-
function $d3cec079d200a848225dc29b5c644d27$var$findEraFromGregorianDate(date) {
|
|
1661
|
-
const idx = $d3cec079d200a848225dc29b5c644d27$var$ERA_START_DATES.findIndex((_ref) => {
|
|
1662
|
-
let [year, month, day] = _ref;
|
|
1663
|
-
|
|
1664
|
-
if (date.year < year) {
|
|
1665
|
-
return true;
|
|
1666
|
-
}
|
|
1667
|
-
|
|
1668
|
-
if (date.year === year && date.month < month) {
|
|
1669
|
-
return true;
|
|
1670
|
-
}
|
|
1671
|
-
|
|
1672
|
-
if (date.year === year && date.month === month && date.day < day) {
|
|
1673
|
-
return true;
|
|
1674
|
-
}
|
|
1675
|
-
|
|
1676
|
-
return false;
|
|
1677
|
-
});
|
|
1678
|
-
|
|
1679
|
-
if (idx === -1) {
|
|
1680
|
-
return $d3cec079d200a848225dc29b5c644d27$var$ERA_START_DATES.length - 1;
|
|
1681
|
-
}
|
|
1682
|
-
|
|
1683
|
-
if (idx === 0) {
|
|
1684
|
-
return 0;
|
|
1685
|
-
}
|
|
1686
|
-
|
|
1687
|
-
return idx - 1;
|
|
1688
|
-
}
|
|
1689
|
-
|
|
1690
|
-
function $d3cec079d200a848225dc29b5c644d27$var$toGregorian(date) {
|
|
1691
|
-
let eraAddend = $d3cec079d200a848225dc29b5c644d27$var$ERA_ADDENDS[$d3cec079d200a848225dc29b5c644d27$var$ERA_NAMES.indexOf(date.era)];
|
|
1692
|
-
|
|
1693
|
-
if (!eraAddend) {
|
|
1694
|
-
throw new Error('Unknown era: ' + date.era);
|
|
1695
|
-
}
|
|
1696
|
-
|
|
1697
|
-
return new CalendarDate(date.year + eraAddend, date.month, date.day);
|
|
1698
|
-
}
|
|
1699
|
-
|
|
1700
|
-
class JapaneseCalendar extends GregorianCalendar {
|
|
1701
|
-
constructor() {
|
|
1702
|
-
super(...arguments);
|
|
1703
|
-
this.identifier = 'japanese';
|
|
1704
|
-
}
|
|
1705
|
-
|
|
1706
|
-
fromJulianDay(jd) {
|
|
1707
|
-
let date = super.fromJulianDay(jd);
|
|
1708
|
-
let era = $d3cec079d200a848225dc29b5c644d27$var$findEraFromGregorianDate(date);
|
|
1709
|
-
date.era = $d3cec079d200a848225dc29b5c644d27$var$ERA_NAMES[era];
|
|
1710
|
-
date.year -= $d3cec079d200a848225dc29b5c644d27$var$ERA_ADDENDS[era];
|
|
1711
|
-
return date;
|
|
1712
|
-
}
|
|
1713
|
-
|
|
1714
|
-
toJulianDay(date) {
|
|
1715
|
-
return super.toJulianDay($d3cec079d200a848225dc29b5c644d27$var$toGregorian(date));
|
|
1716
|
-
}
|
|
1717
|
-
|
|
1718
|
-
balanceDate(date) {
|
|
1719
|
-
let gregorianDate = $d3cec079d200a848225dc29b5c644d27$var$toGregorian(date);
|
|
1720
|
-
let era = $d3cec079d200a848225dc29b5c644d27$var$findEraFromGregorianDate(gregorianDate);
|
|
1721
|
-
|
|
1722
|
-
if ($d3cec079d200a848225dc29b5c644d27$var$ERA_NAMES[era] !== date.era) {
|
|
1723
|
-
date.era = $d3cec079d200a848225dc29b5c644d27$var$ERA_NAMES[era];
|
|
1724
|
-
date.year = gregorianDate.year - $d3cec079d200a848225dc29b5c644d27$var$ERA_ADDENDS[era];
|
|
1725
|
-
}
|
|
1726
|
-
}
|
|
1727
|
-
|
|
1728
|
-
constrainDate(date) {
|
|
1729
|
-
let idx = $d3cec079d200a848225dc29b5c644d27$var$ERA_NAMES.indexOf(date.era);
|
|
1730
|
-
let end = $d3cec079d200a848225dc29b5c644d27$var$ERA_END_DATES[idx];
|
|
1731
|
-
|
|
1732
|
-
if (end != null) {
|
|
1733
|
-
let [endYear, endMonth, endDay] = end; // Constrain the year to the maximum possible value in the era.
|
|
1734
|
-
// Then constrain the month and day fields within that.
|
|
1735
|
-
|
|
1736
|
-
let maxYear = endYear - $d3cec079d200a848225dc29b5c644d27$var$ERA_ADDENDS[idx];
|
|
1737
|
-
date.year = Math.min(maxYear, date.year);
|
|
1738
|
-
|
|
1739
|
-
if (date.year === maxYear) {
|
|
1740
|
-
date.month = Math.min(endMonth, date.month);
|
|
1741
|
-
|
|
1742
|
-
if (date.month === endMonth) {
|
|
1743
|
-
date.day = Math.min(endDay, date.day);
|
|
1744
|
-
}
|
|
1745
|
-
}
|
|
1746
|
-
|
|
1747
|
-
if (date.year === 1) {
|
|
1748
|
-
let [, startMonth, startDay] = $d3cec079d200a848225dc29b5c644d27$var$ERA_START_DATES[idx];
|
|
1749
|
-
date.month = Math.max(startMonth, date.month);
|
|
1750
|
-
|
|
1751
|
-
if (date.month === startMonth) {
|
|
1752
|
-
date.day = Math.max(startDay, date.day);
|
|
1753
|
-
}
|
|
1754
|
-
}
|
|
1755
|
-
}
|
|
1756
|
-
}
|
|
1757
|
-
|
|
1758
|
-
getEras() {
|
|
1759
|
-
return $d3cec079d200a848225dc29b5c644d27$var$ERA_NAMES;
|
|
1760
|
-
}
|
|
1761
|
-
|
|
1762
|
-
getYearsInEra(date) {
|
|
1763
|
-
// Get the number of years in the era, taking into account the date's month and day fields.
|
|
1764
|
-
let era = $d3cec079d200a848225dc29b5c644d27$var$ERA_NAMES.indexOf(date.era);
|
|
1765
|
-
let next = $d3cec079d200a848225dc29b5c644d27$var$ERA_START_DATES[era + 1];
|
|
1766
|
-
|
|
1767
|
-
if (next == null) {
|
|
1768
|
-
return 9999;
|
|
1769
|
-
}
|
|
1770
|
-
|
|
1771
|
-
let cur = $d3cec079d200a848225dc29b5c644d27$var$ERA_START_DATES[era];
|
|
1772
|
-
let years = next[0] - cur[0];
|
|
1773
|
-
|
|
1774
|
-
if (date.month < next[1] || date.month === next[1] && date.day < next[2]) {
|
|
1775
|
-
years++;
|
|
1776
|
-
}
|
|
1777
|
-
|
|
1778
|
-
return years;
|
|
1779
|
-
}
|
|
1780
|
-
|
|
1781
|
-
getMinimumMonthInYear(date) {
|
|
1782
|
-
let start = $d3cec079d200a848225dc29b5c644d27$var$getMinimums(date);
|
|
1783
|
-
return start ? start[1] : 1;
|
|
1784
|
-
}
|
|
1785
|
-
|
|
1786
|
-
getMinimumDayInMonth(date) {
|
|
1787
|
-
let start = $d3cec079d200a848225dc29b5c644d27$var$getMinimums(date);
|
|
1788
|
-
return start && date.month === start[1] ? start[2] : 1;
|
|
1789
|
-
}
|
|
1790
|
-
|
|
1791
|
-
}
|
|
1792
|
-
|
|
1793
|
-
exports.JapaneseCalendar = JapaneseCalendar;
|
|
1794
|
-
|
|
1795
|
-
function $d3cec079d200a848225dc29b5c644d27$var$getMinimums(date) {
|
|
1796
|
-
if (date.year === 1) {
|
|
1797
|
-
let idx = $d3cec079d200a848225dc29b5c644d27$var$ERA_NAMES.indexOf(date.era);
|
|
1798
|
-
return $d3cec079d200a848225dc29b5c644d27$var$ERA_START_DATES[idx];
|
|
1799
|
-
}
|
|
1800
|
-
}
|
|
1801
|
-
|
|
1802
|
-
const $cdfe44306af6bfd9e58fece371a4981$var$BUDDHIST_ERA_START = -543;
|
|
1803
|
-
|
|
1804
|
-
class BuddhistCalendar extends GregorianCalendar {
|
|
1805
|
-
constructor() {
|
|
1806
|
-
super(...arguments);
|
|
1807
|
-
this.identifier = 'buddhist';
|
|
1808
|
-
}
|
|
1809
|
-
|
|
1810
|
-
fromJulianDay(jd) {
|
|
1811
|
-
let date = super.fromJulianDay(jd);
|
|
1812
|
-
date.year -= $cdfe44306af6bfd9e58fece371a4981$var$BUDDHIST_ERA_START;
|
|
1813
|
-
return date;
|
|
1814
|
-
}
|
|
1815
|
-
|
|
1816
|
-
toJulianDay(date) {
|
|
1817
|
-
return super.toJulianDay(new CalendarDate(date.year + $cdfe44306af6bfd9e58fece371a4981$var$BUDDHIST_ERA_START, date.month, date.day));
|
|
1818
|
-
}
|
|
1819
|
-
|
|
1820
|
-
getEras() {
|
|
1821
|
-
return ['BE'];
|
|
1822
|
-
}
|
|
1823
|
-
|
|
1824
|
-
}
|
|
1825
|
-
|
|
1826
|
-
exports.BuddhistCalendar = BuddhistCalendar;
|
|
1827
|
-
const $bfc8860ccf9284c7ca2a2d1fdf8e42$var$TAIWAN_ERA_START = 1911;
|
|
1828
|
-
|
|
1829
|
-
function $bfc8860ccf9284c7ca2a2d1fdf8e42$var$gregorianYear(date) {
|
|
1830
|
-
return date.era === 'minguo' ? date.year + $bfc8860ccf9284c7ca2a2d1fdf8e42$var$TAIWAN_ERA_START : 1 - date.year + $bfc8860ccf9284c7ca2a2d1fdf8e42$var$TAIWAN_ERA_START;
|
|
1831
|
-
}
|
|
1832
|
-
|
|
1833
|
-
function $bfc8860ccf9284c7ca2a2d1fdf8e42$var$gregorianToTaiwan(year, date) {
|
|
1834
|
-
let y = year - $bfc8860ccf9284c7ca2a2d1fdf8e42$var$TAIWAN_ERA_START;
|
|
1835
|
-
|
|
1836
|
-
if (y > 0) {
|
|
1837
|
-
date.era = 'minguo';
|
|
1838
|
-
date.year = y;
|
|
1839
|
-
} else {
|
|
1840
|
-
date.era = 'before_minguo';
|
|
1841
|
-
date.year = 1 - y;
|
|
1842
|
-
}
|
|
1843
|
-
}
|
|
1844
|
-
|
|
1845
|
-
class TaiwanCalendar extends GregorianCalendar {
|
|
1846
|
-
constructor() {
|
|
1847
|
-
super(...arguments);
|
|
1848
|
-
this.identifier = 'roc';
|
|
1849
|
-
}
|
|
1850
|
-
|
|
1851
|
-
// Republic of China
|
|
1852
|
-
fromJulianDay(jd) {
|
|
1853
|
-
let date = super.fromJulianDay(jd);
|
|
1854
|
-
$bfc8860ccf9284c7ca2a2d1fdf8e42$var$gregorianToTaiwan(date.year, date);
|
|
1855
|
-
return date;
|
|
1856
|
-
}
|
|
1857
|
-
|
|
1858
|
-
toJulianDay(date) {
|
|
1859
|
-
return super.toJulianDay(new CalendarDate($bfc8860ccf9284c7ca2a2d1fdf8e42$var$gregorianYear(date), date.month, date.day));
|
|
1860
|
-
}
|
|
1861
|
-
|
|
1862
|
-
getEras() {
|
|
1863
|
-
return ['before_minguo', 'minguo'];
|
|
1864
|
-
}
|
|
1865
|
-
|
|
1866
|
-
balanceDate(date) {
|
|
1867
|
-
$bfc8860ccf9284c7ca2a2d1fdf8e42$var$gregorianToTaiwan($bfc8860ccf9284c7ca2a2d1fdf8e42$var$gregorianYear(date), date);
|
|
1868
|
-
}
|
|
1869
|
-
|
|
1870
|
-
getYearsToAdd(date, years) {
|
|
1871
|
-
return date.era === 'before_minguo' ? -years : years;
|
|
1872
|
-
}
|
|
1873
|
-
|
|
1874
|
-
}
|
|
1875
|
-
|
|
1876
|
-
exports.TaiwanCalendar = TaiwanCalendar;
|
|
1877
|
-
const $f9a4dcf1024f37434b4f773b9f10f678$var$PERSIAN_EPOCH = 1948321; // 622/03/19 Julian C.E.
|
|
1878
|
-
|
|
1879
|
-
function $f9a4dcf1024f37434b4f773b9f10f678$var$isLeapYear(year) {
|
|
1880
|
-
let y0 = year > 0 ? year - 474 : year - 473;
|
|
1881
|
-
let y1 = $f839ba72fcd1ea0f3280c95c38c6e83$export$mod(y0, 2820) + 474;
|
|
1882
|
-
return $f839ba72fcd1ea0f3280c95c38c6e83$export$mod((y1 + 38) * 31, 128) < 31;
|
|
1883
|
-
}
|
|
1884
|
-
|
|
1885
|
-
function $f9a4dcf1024f37434b4f773b9f10f678$var$persianToJulianDay(year, month, day) {
|
|
1886
|
-
let y0 = year > 0 ? year - 474 : year - 473;
|
|
1887
|
-
let y1 = $f839ba72fcd1ea0f3280c95c38c6e83$export$mod(y0, 2820) + 474;
|
|
1888
|
-
let offset = month <= 7 ? 31 * (month - 1) : 30 * (month - 1) + 6;
|
|
1889
|
-
return $f9a4dcf1024f37434b4f773b9f10f678$var$PERSIAN_EPOCH - 1 + 1029983 * Math.floor(y0 / 2820) + 365 * (y1 - 1) + Math.floor((31 * y1 - 5) / 128) + offset + day;
|
|
1890
|
-
}
|
|
1891
|
-
|
|
1892
|
-
class PersianCalendar {
|
|
1893
|
-
constructor() {
|
|
1894
|
-
this.identifier = 'persian';
|
|
1895
|
-
}
|
|
1896
|
-
|
|
1897
|
-
fromJulianDay(jd) {
|
|
1898
|
-
let d0 = jd - $f9a4dcf1024f37434b4f773b9f10f678$var$persianToJulianDay(475, 1, 1);
|
|
1899
|
-
let n2820 = Math.floor(d0 / 1029983);
|
|
1900
|
-
let d1 = $f839ba72fcd1ea0f3280c95c38c6e83$export$mod(d0, 1029983);
|
|
1901
|
-
let y2820 = d1 === 1029982 ? 2820 : Math.floor((128 * d1 + 46878) / 46751);
|
|
1902
|
-
let year = 474 + 2820 * n2820 + y2820;
|
|
1903
|
-
|
|
1904
|
-
if (year <= 0) {
|
|
1905
|
-
year--;
|
|
1906
|
-
}
|
|
1907
|
-
|
|
1908
|
-
let yDay = jd - $f9a4dcf1024f37434b4f773b9f10f678$var$persianToJulianDay(year, 1, 1) + 1;
|
|
1909
|
-
let month = yDay <= 186 ? Math.ceil(yDay / 31) : Math.ceil((yDay - 6) / 31);
|
|
1910
|
-
let day = jd - $f9a4dcf1024f37434b4f773b9f10f678$var$persianToJulianDay(year, month, 1) + 1;
|
|
1911
|
-
return new CalendarDate(this, year, month, day);
|
|
1912
|
-
}
|
|
1913
|
-
|
|
1914
|
-
toJulianDay(date) {
|
|
1915
|
-
return $f9a4dcf1024f37434b4f773b9f10f678$var$persianToJulianDay(date.year, date.month, date.day);
|
|
1916
|
-
}
|
|
1917
|
-
|
|
1918
|
-
getMonthsInYear() {
|
|
1919
|
-
return 12;
|
|
1920
|
-
}
|
|
1921
|
-
|
|
1922
|
-
getDaysInMonth(date) {
|
|
1923
|
-
if (date.month <= 6) {
|
|
1924
|
-
return 31;
|
|
1925
|
-
}
|
|
1926
|
-
|
|
1927
|
-
if (date.month <= 11) {
|
|
1928
|
-
return 30;
|
|
1929
|
-
}
|
|
1930
|
-
|
|
1931
|
-
return $f9a4dcf1024f37434b4f773b9f10f678$var$isLeapYear(date.year) ? 30 : 29;
|
|
1932
|
-
}
|
|
1933
|
-
|
|
1934
|
-
getEras() {
|
|
1935
|
-
return ['AP'];
|
|
1936
|
-
}
|
|
1937
|
-
|
|
1938
|
-
getYearsInEra() {
|
|
1939
|
-
return 9999;
|
|
1940
|
-
}
|
|
1941
|
-
|
|
1942
|
-
}
|
|
1943
|
-
|
|
1944
|
-
exports.PersianCalendar = PersianCalendar;
|
|
1945
|
-
// Starts in 78 AD,
|
|
1946
|
-
const $f7146730260e0b69febbbb2e5deb182b$var$INDIAN_ERA_START = 78; // The Indian year starts 80 days later than the Gregorian year.
|
|
1947
|
-
|
|
1948
|
-
const $f7146730260e0b69febbbb2e5deb182b$var$INDIAN_YEAR_START = 80;
|
|
1949
|
-
|
|
1950
|
-
class IndianCalendar extends GregorianCalendar {
|
|
1951
|
-
constructor() {
|
|
1952
|
-
super(...arguments);
|
|
1953
|
-
this.identifier = 'indian';
|
|
1954
|
-
}
|
|
1955
|
-
|
|
1956
|
-
fromJulianDay(jd) {
|
|
1957
|
-
// Gregorian date for Julian day
|
|
1958
|
-
let date = super.fromJulianDay(jd); // Year in Saka era
|
|
1959
|
-
|
|
1960
|
-
let indianYear = date.year - $f7146730260e0b69febbbb2e5deb182b$var$INDIAN_ERA_START; // Day number in Gregorian year (starting from 0)
|
|
1961
|
-
|
|
1962
|
-
let yDay = jd - $fdb27fe8d5b8ff356e836fe61f3645c$export$gregorianToJulianDay(date.year, 1, 1);
|
|
1963
|
-
let leapMonth;
|
|
1964
|
-
|
|
1965
|
-
if (yDay < $f7146730260e0b69febbbb2e5deb182b$var$INDIAN_YEAR_START) {
|
|
1966
|
-
// Day is at the end of the preceding Saka year
|
|
1967
|
-
indianYear--; // Days in leapMonth this year, previous Gregorian year
|
|
1968
|
-
|
|
1969
|
-
leapMonth = $fdb27fe8d5b8ff356e836fe61f3645c$export$isLeapYear(date.year - 1) ? 31 : 30;
|
|
1970
|
-
yDay += leapMonth + 31 * 5 + 30 * 3 + 10;
|
|
1971
|
-
} else {
|
|
1972
|
-
// Days in leapMonth this year
|
|
1973
|
-
leapMonth = $fdb27fe8d5b8ff356e836fe61f3645c$export$isLeapYear(date.year) ? 31 : 30;
|
|
1974
|
-
yDay -= $f7146730260e0b69febbbb2e5deb182b$var$INDIAN_YEAR_START;
|
|
1975
|
-
}
|
|
1976
|
-
|
|
1977
|
-
let indianMonth;
|
|
1978
|
-
let indianDay;
|
|
1979
|
-
|
|
1980
|
-
if (yDay < leapMonth) {
|
|
1981
|
-
indianMonth = 1;
|
|
1982
|
-
indianDay = yDay + 1;
|
|
1983
|
-
} else {
|
|
1984
|
-
let mDay = yDay - leapMonth;
|
|
1985
|
-
|
|
1986
|
-
if (mDay < 31 * 5) {
|
|
1987
|
-
indianMonth = Math.floor(mDay / 31) + 2;
|
|
1988
|
-
indianDay = mDay % 31 + 1;
|
|
1989
|
-
} else {
|
|
1990
|
-
mDay -= 31 * 5;
|
|
1991
|
-
indianMonth = Math.floor(mDay / 30) + 7;
|
|
1992
|
-
indianDay = mDay % 30 + 1;
|
|
1993
|
-
}
|
|
1994
|
-
}
|
|
1995
|
-
|
|
1996
|
-
return new CalendarDate(this, indianYear, indianMonth, indianDay);
|
|
1997
|
-
}
|
|
1998
|
-
|
|
1999
|
-
toJulianDay(date) {
|
|
2000
|
-
let year = date.year + $f7146730260e0b69febbbb2e5deb182b$var$INDIAN_ERA_START;
|
|
2001
|
-
let leapMonth;
|
|
2002
|
-
let jd;
|
|
2003
|
-
|
|
2004
|
-
if ($fdb27fe8d5b8ff356e836fe61f3645c$export$isLeapYear(year)) {
|
|
2005
|
-
leapMonth = 31;
|
|
2006
|
-
jd = $fdb27fe8d5b8ff356e836fe61f3645c$export$gregorianToJulianDay(year, 3, 21);
|
|
2007
|
-
} else {
|
|
2008
|
-
leapMonth = 30;
|
|
2009
|
-
jd = $fdb27fe8d5b8ff356e836fe61f3645c$export$gregorianToJulianDay(year, 3, 22);
|
|
2010
|
-
}
|
|
2011
|
-
|
|
2012
|
-
if (date.month === 1) {
|
|
2013
|
-
return jd + date.day - 1;
|
|
2014
|
-
}
|
|
2015
|
-
|
|
2016
|
-
jd += leapMonth + Math.min(date.month - 2, 5) * 31;
|
|
2017
|
-
|
|
2018
|
-
if (date.month >= 8) {
|
|
2019
|
-
jd += (date.month - 7) * 30;
|
|
2020
|
-
}
|
|
2021
|
-
|
|
2022
|
-
jd += date.day - 1;
|
|
2023
|
-
return jd;
|
|
2024
|
-
}
|
|
2025
|
-
|
|
2026
|
-
getDaysInMonth(date) {
|
|
2027
|
-
if (date.month === 1 && $fdb27fe8d5b8ff356e836fe61f3645c$export$isLeapYear(date.year + $f7146730260e0b69febbbb2e5deb182b$var$INDIAN_ERA_START)) {
|
|
2028
|
-
return 31;
|
|
2029
|
-
}
|
|
2030
|
-
|
|
2031
|
-
if (date.month >= 2 && date.month <= 6) {
|
|
2032
|
-
return 31;
|
|
2033
|
-
}
|
|
2034
|
-
|
|
2035
|
-
return 30;
|
|
2036
|
-
}
|
|
2037
|
-
|
|
2038
|
-
getYearsInEra() {
|
|
2039
|
-
return 9999;
|
|
2040
|
-
}
|
|
2041
|
-
|
|
2042
|
-
getEras() {
|
|
2043
|
-
return ['saka'];
|
|
2044
|
-
}
|
|
2045
|
-
|
|
2046
|
-
}
|
|
2047
|
-
|
|
2048
|
-
exports.IndianCalendar = IndianCalendar;
|
|
2049
|
-
const $a989b48226b9ac44fe33c05c41f3b63$var$CIVIL_EPOC = 1948440; // CE 622 July 16 Friday (Julian calendar) / CE 622 July 19 (Gregorian calendar)
|
|
2050
|
-
|
|
2051
|
-
const $a989b48226b9ac44fe33c05c41f3b63$var$ASTRONOMICAL_EPOC = 1948439; // CE 622 July 15 Thursday (Julian calendar)
|
|
2052
|
-
|
|
2053
|
-
const $a989b48226b9ac44fe33c05c41f3b63$var$UMALQURA_YEAR_START = 1300;
|
|
2054
|
-
const $a989b48226b9ac44fe33c05c41f3b63$var$UMALQURA_YEAR_END = 1600;
|
|
2055
|
-
const $a989b48226b9ac44fe33c05c41f3b63$var$UMALQURA_START_DAYS = 460322;
|
|
2056
|
-
|
|
2057
|
-
function $a989b48226b9ac44fe33c05c41f3b63$var$islamicToJulianDay(epoch, year, month, day) {
|
|
2058
|
-
return day + Math.ceil(29.5 * (month - 1)) + (year - 1) * 354 + Math.floor((3 + 11 * year) / 30) + epoch - 1;
|
|
2059
|
-
}
|
|
2060
|
-
|
|
2061
|
-
function $a989b48226b9ac44fe33c05c41f3b63$var$julianDayToIslamic(calendar, epoch, jd) {
|
|
2062
|
-
let year = Math.floor((30 * (jd - epoch) + 10646) / 10631);
|
|
2063
|
-
let month = Math.min(12, Math.ceil((jd - (29 + $a989b48226b9ac44fe33c05c41f3b63$var$islamicToJulianDay(epoch, year, 1, 1))) / 29.5) + 1);
|
|
2064
|
-
let day = jd - $a989b48226b9ac44fe33c05c41f3b63$var$islamicToJulianDay(epoch, year, month, 1) + 1;
|
|
2065
|
-
return new CalendarDate(calendar, year, month, day);
|
|
2066
|
-
}
|
|
2067
|
-
|
|
2068
|
-
function $a989b48226b9ac44fe33c05c41f3b63$var$isLeapYear(year) {
|
|
2069
|
-
return (14 + 11 * year) % 30 < 11;
|
|
2070
|
-
}
|
|
2071
|
-
|
|
2072
|
-
class IslamicCivilCalendar {
|
|
2073
|
-
constructor() {
|
|
2074
|
-
this.identifier = 'islamic-civil';
|
|
2075
|
-
}
|
|
2076
|
-
|
|
2077
|
-
fromJulianDay(jd) {
|
|
2078
|
-
return $a989b48226b9ac44fe33c05c41f3b63$var$julianDayToIslamic(this, $a989b48226b9ac44fe33c05c41f3b63$var$CIVIL_EPOC, jd);
|
|
2079
|
-
}
|
|
2080
|
-
|
|
2081
|
-
toJulianDay(date) {
|
|
2082
|
-
return $a989b48226b9ac44fe33c05c41f3b63$var$islamicToJulianDay($a989b48226b9ac44fe33c05c41f3b63$var$CIVIL_EPOC, date.year, date.month, date.day);
|
|
2083
|
-
}
|
|
2084
|
-
|
|
2085
|
-
getDaysInMonth(date) {
|
|
2086
|
-
let length = 29 + date.month % 2;
|
|
2087
|
-
|
|
2088
|
-
if (date.month === 12 && $a989b48226b9ac44fe33c05c41f3b63$var$isLeapYear(date.year)) {
|
|
2089
|
-
length++;
|
|
2090
|
-
}
|
|
2091
|
-
|
|
2092
|
-
return length;
|
|
2093
|
-
}
|
|
2094
|
-
|
|
2095
|
-
getMonthsInYear() {
|
|
2096
|
-
return 12;
|
|
2097
|
-
}
|
|
2098
|
-
|
|
2099
|
-
getDaysInYear(date) {
|
|
2100
|
-
return $a989b48226b9ac44fe33c05c41f3b63$var$isLeapYear(date.year) ? 355 : 354;
|
|
2101
|
-
}
|
|
2102
|
-
|
|
2103
|
-
getYearsInEra() {
|
|
2104
|
-
return 9999;
|
|
2105
|
-
}
|
|
2106
|
-
|
|
2107
|
-
getEras() {
|
|
2108
|
-
return ['AH'];
|
|
2109
|
-
}
|
|
2110
|
-
|
|
2111
|
-
}
|
|
2112
|
-
|
|
2113
|
-
exports.IslamicCivilCalendar = IslamicCivilCalendar;
|
|
2114
|
-
|
|
2115
|
-
class IslamicTabularCalendar extends IslamicCivilCalendar {
|
|
2116
|
-
constructor() {
|
|
2117
|
-
super(...arguments);
|
|
2118
|
-
this.identifier = 'islamic-tbla';
|
|
2119
|
-
}
|
|
2120
|
-
|
|
2121
|
-
fromJulianDay(jd) {
|
|
2122
|
-
return $a989b48226b9ac44fe33c05c41f3b63$var$julianDayToIslamic(this, $a989b48226b9ac44fe33c05c41f3b63$var$ASTRONOMICAL_EPOC, jd);
|
|
2123
|
-
}
|
|
2124
|
-
|
|
2125
|
-
toJulianDay(date) {
|
|
2126
|
-
return $a989b48226b9ac44fe33c05c41f3b63$var$islamicToJulianDay($a989b48226b9ac44fe33c05c41f3b63$var$ASTRONOMICAL_EPOC, date.year, date.month, date.day);
|
|
2127
|
-
}
|
|
2128
|
-
|
|
2129
|
-
} // Generated by scripts/generate-umalqura.js
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
exports.IslamicTabularCalendar = IslamicTabularCalendar;
|
|
2133
|
-
const $a989b48226b9ac44fe33c05c41f3b63$var$UMALQURA_DATA = 'qgpUDckO1AbqBmwDrQpVBakGkgepC9QF2gpcBS0NlQZKB1QLagutBa4ETwoXBYsGpQbVCtYCWwmdBE0KJg2VDawFtgm6AlsKKwWVCsoG6Qr0AnYJtgJWCcoKpAvSC9kF3AJtCU0FpQpSC6ULtAW2CVcFlwJLBaMGUgdlC2oFqworBZUMSg2lDcoF1gpXCasESwmlClILagt1BXYCtwhbBFUFqQW0BdoJ3QRuAjYJqgpUDbIN1QXaAlsJqwRVCkkLZAtxC7QFtQpVCiUNkg7JDtQG6QprCasEkwpJDaQNsg25CroEWworBZUKKgtVC1wFvQQ9Ah0JlQpKC1oLbQW2AjsJmwRVBqkGVAdqC2wFrQpVBSkLkgupC9QF2gpaBasKlQVJB2QHqgu1BbYCVgpNDiULUgtqC60FrgIvCZcESwalBqwG1gpdBZ0ETQoWDZUNqgW1BdoCWwmtBJUFygbkBuoK9QS2AlYJqgpUC9IL2QXqAm0JrQSVCkoLpQuyBbUJ1gSXCkcFkwZJB1ULagVrCisFiwpGDaMNygXWCtsEawJLCaUKUgtpC3UFdgG3CFsCKwVlBbQF2gntBG0BtgimClINqQ3UBdoKWwmrBFMGKQdiB6kLsgW1ClUFJQuSDckO0gbpCmsFqwRVCikNVA2qDbUJugQ7CpsETQqqCtUK2gJdCV4ELgqaDFUNsga5BroEXQotBZUKUguoC7QLuQXaAloJSgukDdEO6AZqC20FNQWVBkoNqA3UDdoGWwWdAisGFQtKC5ULqgWuCi4JjwwnBZUGqgbWCl0FnQI=';
|
|
2134
|
-
let $a989b48226b9ac44fe33c05c41f3b63$var$UMALQURA_MONTHLENGTH;
|
|
2135
|
-
let $a989b48226b9ac44fe33c05c41f3b63$var$UMALQURA_YEAR_START_TABLE;
|
|
2136
|
-
|
|
2137
|
-
function $a989b48226b9ac44fe33c05c41f3b63$var$umalquraYearStart(year) {
|
|
2138
|
-
return $a989b48226b9ac44fe33c05c41f3b63$var$UMALQURA_START_DAYS + $a989b48226b9ac44fe33c05c41f3b63$var$UMALQURA_YEAR_START_TABLE[year - $a989b48226b9ac44fe33c05c41f3b63$var$UMALQURA_YEAR_START];
|
|
2139
|
-
}
|
|
2140
|
-
|
|
2141
|
-
function $a989b48226b9ac44fe33c05c41f3b63$var$umalquraMonthLength(year, month) {
|
|
2142
|
-
let idx = year - $a989b48226b9ac44fe33c05c41f3b63$var$UMALQURA_YEAR_START;
|
|
2143
|
-
let mask = 0x01 << 11 - (month - 1);
|
|
2144
|
-
|
|
2145
|
-
if (($a989b48226b9ac44fe33c05c41f3b63$var$UMALQURA_MONTHLENGTH[idx] & mask) === 0) {
|
|
2146
|
-
return 29;
|
|
2147
|
-
} else {
|
|
2148
|
-
return 30;
|
|
2149
|
-
}
|
|
2150
|
-
}
|
|
2151
|
-
|
|
2152
|
-
function $a989b48226b9ac44fe33c05c41f3b63$var$umalquraMonthStart(year, month) {
|
|
2153
|
-
let day = $a989b48226b9ac44fe33c05c41f3b63$var$umalquraYearStart(year);
|
|
2154
|
-
|
|
2155
|
-
for (let i = 1; i < month; i++) {
|
|
2156
|
-
day += $a989b48226b9ac44fe33c05c41f3b63$var$umalquraMonthLength(year, i);
|
|
2157
|
-
}
|
|
2158
|
-
|
|
2159
|
-
return day;
|
|
2160
1270
|
}
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
1271
|
+
class $9bb5411e4ba634f9$export$d3b7288e7994edea {
|
|
1272
|
+
// This prevents TypeScript from allowing other types with the same fields to match.
|
|
1273
|
+
#type;
|
|
1274
|
+
constructor(...args){
|
|
1275
|
+
let [calendar, era, year, month, day] = $9bb5411e4ba634f9$var$shiftArgs(args);
|
|
1276
|
+
let timeZone = args.shift();
|
|
1277
|
+
let offset = args.shift();
|
|
1278
|
+
this.calendar = calendar;
|
|
1279
|
+
this.era = era;
|
|
1280
|
+
this.year = year;
|
|
1281
|
+
this.month = month;
|
|
1282
|
+
this.day = day;
|
|
1283
|
+
this.timeZone = timeZone;
|
|
1284
|
+
this.offset = offset;
|
|
1285
|
+
this.hour = args.shift() || 0;
|
|
1286
|
+
this.minute = args.shift() || 0;
|
|
1287
|
+
this.second = args.shift() || 0;
|
|
1288
|
+
this.millisecond = args.shift() || 0;
|
|
1289
|
+
$2ae8fe19e7cd4af8$export$c4e2ecac49351ef2(this);
|
|
1290
|
+
}
|
|
1291
|
+
copy() {
|
|
1292
|
+
if (this.era) return new $9bb5411e4ba634f9$export$d3b7288e7994edea(this.calendar, this.era, this.year, this.month, this.day, this.timeZone, this.offset, this.hour, this.minute, this.second, this.millisecond);
|
|
1293
|
+
else return new $9bb5411e4ba634f9$export$d3b7288e7994edea(this.calendar, this.year, this.month, this.day, this.timeZone, this.offset, this.hour, this.minute, this.second, this.millisecond);
|
|
1294
|
+
}
|
|
1295
|
+
add(duration) {
|
|
1296
|
+
return $2ae8fe19e7cd4af8$export$96b1d28349274637(this, duration);
|
|
1297
|
+
}
|
|
1298
|
+
subtract(duration) {
|
|
1299
|
+
return $2ae8fe19e7cd4af8$export$6814caac34ca03c7(this, duration);
|
|
1300
|
+
}
|
|
1301
|
+
set(fields, disambiguation) {
|
|
1302
|
+
return $2ae8fe19e7cd4af8$export$31b5430eb18be4f8(this, fields, disambiguation);
|
|
1303
|
+
}
|
|
1304
|
+
cycle(field, amount, options) {
|
|
1305
|
+
return $2ae8fe19e7cd4af8$export$9a297d111fc86b79(this, field, amount, options);
|
|
1306
|
+
}
|
|
1307
|
+
toDate() {
|
|
1308
|
+
return $1842b789961e6c21$export$83aac07b4c37b25(this);
|
|
1309
|
+
}
|
|
1310
|
+
toString() {
|
|
1311
|
+
return $6cc7196afcc354cc$export$bf79f1ebf4b18792(this);
|
|
1312
|
+
}
|
|
1313
|
+
toAbsoluteString() {
|
|
1314
|
+
return this.toDate().toISOString();
|
|
1315
|
+
}
|
|
1316
|
+
compare(b) {
|
|
1317
|
+
// TODO: Is this a bad idea??
|
|
1318
|
+
return this.toDate().getTime() - $1842b789961e6c21$export$84c95a83c799e074(b, this.timeZone).toDate().getTime();
|
|
1319
|
+
}
|
|
2164
1320
|
}
|
|
2165
1321
|
|
|
2166
|
-
class IslamicUmalquraCalendar extends IslamicCivilCalendar {
|
|
2167
|
-
constructor() {
|
|
2168
|
-
super();
|
|
2169
|
-
this.identifier = 'islamic-umalqura';
|
|
2170
1322
|
|
|
2171
|
-
if (!$a989b48226b9ac44fe33c05c41f3b63$var$UMALQURA_MONTHLENGTH) {
|
|
2172
|
-
$a989b48226b9ac44fe33c05c41f3b63$var$UMALQURA_MONTHLENGTH = new Uint16Array(Uint8Array.from(atob($a989b48226b9ac44fe33c05c41f3b63$var$UMALQURA_DATA), c => c.charCodeAt(0)).buffer);
|
|
2173
|
-
}
|
|
2174
1323
|
|
|
2175
|
-
if (!$a989b48226b9ac44fe33c05c41f3b63$var$UMALQURA_YEAR_START_TABLE) {
|
|
2176
|
-
$a989b48226b9ac44fe33c05c41f3b63$var$UMALQURA_YEAR_START_TABLE = new Uint32Array($a989b48226b9ac44fe33c05c41f3b63$var$UMALQURA_YEAR_END - $a989b48226b9ac44fe33c05c41f3b63$var$UMALQURA_YEAR_START + 1);
|
|
2177
|
-
let yearStart = 0;
|
|
2178
1324
|
|
|
2179
|
-
for (let year = $a989b48226b9ac44fe33c05c41f3b63$var$UMALQURA_YEAR_START; year <= $a989b48226b9ac44fe33c05c41f3b63$var$UMALQURA_YEAR_END; year++) {
|
|
2180
|
-
$a989b48226b9ac44fe33c05c41f3b63$var$UMALQURA_YEAR_START_TABLE[year - $a989b48226b9ac44fe33c05c41f3b63$var$UMALQURA_YEAR_START] = yearStart;
|
|
2181
1325
|
|
|
2182
|
-
|
|
2183
|
-
|
|
1326
|
+
const $4c8188d4ddf4ec96$var$ERA_START_DATES = [
|
|
1327
|
+
[
|
|
1328
|
+
1868,
|
|
1329
|
+
9,
|
|
1330
|
+
8
|
|
1331
|
+
],
|
|
1332
|
+
[
|
|
1333
|
+
1912,
|
|
1334
|
+
7,
|
|
1335
|
+
30
|
|
1336
|
+
],
|
|
1337
|
+
[
|
|
1338
|
+
1926,
|
|
1339
|
+
12,
|
|
1340
|
+
25
|
|
1341
|
+
],
|
|
1342
|
+
[
|
|
1343
|
+
1989,
|
|
1344
|
+
1,
|
|
1345
|
+
8
|
|
1346
|
+
],
|
|
1347
|
+
[
|
|
1348
|
+
2019,
|
|
1349
|
+
5,
|
|
1350
|
+
1
|
|
1351
|
+
]
|
|
1352
|
+
];
|
|
1353
|
+
const $4c8188d4ddf4ec96$var$ERA_END_DATES = [
|
|
1354
|
+
[
|
|
1355
|
+
1912,
|
|
1356
|
+
7,
|
|
1357
|
+
29
|
|
1358
|
+
],
|
|
1359
|
+
[
|
|
1360
|
+
1926,
|
|
1361
|
+
12,
|
|
1362
|
+
24
|
|
1363
|
+
],
|
|
1364
|
+
[
|
|
1365
|
+
1989,
|
|
1366
|
+
1,
|
|
1367
|
+
7
|
|
1368
|
+
],
|
|
1369
|
+
[
|
|
1370
|
+
2019,
|
|
1371
|
+
4,
|
|
1372
|
+
30
|
|
1373
|
+
]
|
|
1374
|
+
];
|
|
1375
|
+
const $4c8188d4ddf4ec96$var$ERA_ADDENDS = [
|
|
1376
|
+
1867,
|
|
1377
|
+
1911,
|
|
1378
|
+
1925,
|
|
1379
|
+
1988,
|
|
1380
|
+
2018
|
|
1381
|
+
];
|
|
1382
|
+
const $4c8188d4ddf4ec96$var$ERA_NAMES = [
|
|
1383
|
+
'meiji',
|
|
1384
|
+
'taisho',
|
|
1385
|
+
'showa',
|
|
1386
|
+
'heisei',
|
|
1387
|
+
'reiwa'
|
|
1388
|
+
];
|
|
1389
|
+
function $4c8188d4ddf4ec96$var$findEraFromGregorianDate(date) {
|
|
1390
|
+
const idx = $4c8188d4ddf4ec96$var$ERA_START_DATES.findIndex(([year, month, day])=>{
|
|
1391
|
+
if (date.year < year) return true;
|
|
1392
|
+
if (date.year === year && date.month < month) return true;
|
|
1393
|
+
if (date.year === year && date.month === month && date.day < day) return true;
|
|
1394
|
+
return false;
|
|
1395
|
+
});
|
|
1396
|
+
if (idx === -1) return $4c8188d4ddf4ec96$var$ERA_START_DATES.length - 1;
|
|
1397
|
+
if (idx === 0) return 0;
|
|
1398
|
+
return idx - 1;
|
|
1399
|
+
}
|
|
1400
|
+
function $4c8188d4ddf4ec96$var$toGregorian(date) {
|
|
1401
|
+
let eraAddend = $4c8188d4ddf4ec96$var$ERA_ADDENDS[$4c8188d4ddf4ec96$var$ERA_NAMES.indexOf(date.era)];
|
|
1402
|
+
if (!eraAddend) throw new Error('Unknown era: ' + date.era);
|
|
1403
|
+
return new $9bb5411e4ba634f9$export$99faa760c7908e4f(date.year + eraAddend, date.month, date.day);
|
|
1404
|
+
}
|
|
1405
|
+
class $4c8188d4ddf4ec96$export$b746ab2b60cdffbf extends $5adb4cba079e6f7b$export$80ee6245ec4f29ec {
|
|
1406
|
+
fromJulianDay(jd) {
|
|
1407
|
+
let date = super.fromJulianDay(jd);
|
|
1408
|
+
let era = $4c8188d4ddf4ec96$var$findEraFromGregorianDate(date);
|
|
1409
|
+
date.era = $4c8188d4ddf4ec96$var$ERA_NAMES[era];
|
|
1410
|
+
date.year -= $4c8188d4ddf4ec96$var$ERA_ADDENDS[era];
|
|
1411
|
+
return date;
|
|
1412
|
+
}
|
|
1413
|
+
toJulianDay(date) {
|
|
1414
|
+
return super.toJulianDay($4c8188d4ddf4ec96$var$toGregorian(date));
|
|
1415
|
+
}
|
|
1416
|
+
balanceDate(date) {
|
|
1417
|
+
let gregorianDate = $4c8188d4ddf4ec96$var$toGregorian(date);
|
|
1418
|
+
let era = $4c8188d4ddf4ec96$var$findEraFromGregorianDate(gregorianDate);
|
|
1419
|
+
if ($4c8188d4ddf4ec96$var$ERA_NAMES[era] !== date.era) {
|
|
1420
|
+
date.era = $4c8188d4ddf4ec96$var$ERA_NAMES[era];
|
|
1421
|
+
date.year = gregorianDate.year - $4c8188d4ddf4ec96$var$ERA_ADDENDS[era];
|
|
2184
1422
|
}
|
|
2185
|
-
}
|
|
2186
1423
|
}
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
if (d === yearLength) {
|
|
2207
|
-
m = 12;
|
|
2208
|
-
break;
|
|
2209
|
-
} else if (d < yearLength) {
|
|
2210
|
-
let monthLength = $a989b48226b9ac44fe33c05c41f3b63$var$umalquraMonthLength(y, m);
|
|
2211
|
-
m = 1;
|
|
2212
|
-
|
|
2213
|
-
while (d > monthLength) {
|
|
2214
|
-
d -= monthLength;
|
|
2215
|
-
m++;
|
|
2216
|
-
monthLength = $a989b48226b9ac44fe33c05c41f3b63$var$umalquraMonthLength(y, m);
|
|
2217
|
-
}
|
|
2218
|
-
|
|
2219
|
-
break;
|
|
1424
|
+
constrainDate(date) {
|
|
1425
|
+
let idx = $4c8188d4ddf4ec96$var$ERA_NAMES.indexOf(date.era);
|
|
1426
|
+
let end = $4c8188d4ddf4ec96$var$ERA_END_DATES[idx];
|
|
1427
|
+
if (end != null) {
|
|
1428
|
+
let [endYear, endMonth, endDay] = end;
|
|
1429
|
+
// Constrain the year to the maximum possible value in the era.
|
|
1430
|
+
// Then constrain the month and day fields within that.
|
|
1431
|
+
let maxYear = endYear - $4c8188d4ddf4ec96$var$ERA_ADDENDS[idx];
|
|
1432
|
+
date.year = Math.min(maxYear, date.year);
|
|
1433
|
+
if (date.year === maxYear) {
|
|
1434
|
+
date.month = Math.min(endMonth, date.month);
|
|
1435
|
+
if (date.month === endMonth) date.day = Math.min(endDay, date.day);
|
|
1436
|
+
}
|
|
1437
|
+
if (date.year === 1) {
|
|
1438
|
+
let [, startMonth, startDay] = $4c8188d4ddf4ec96$var$ERA_START_DATES[idx];
|
|
1439
|
+
date.month = Math.max(startMonth, date.month);
|
|
1440
|
+
if (date.month === startMonth) date.day = Math.max(startDay, date.day);
|
|
1441
|
+
}
|
|
2220
1442
|
}
|
|
2221
|
-
}
|
|
2222
|
-
|
|
2223
|
-
return new CalendarDate(this, y, m, days - $a989b48226b9ac44fe33c05c41f3b63$var$umalquraMonthStart(y, m) + 1);
|
|
2224
1443
|
}
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
toJulianDay(date) {
|
|
2228
|
-
if (date.year < $a989b48226b9ac44fe33c05c41f3b63$var$UMALQURA_YEAR_START || date.year > $a989b48226b9ac44fe33c05c41f3b63$var$UMALQURA_YEAR_END) {
|
|
2229
|
-
return super.toJulianDay(date);
|
|
1444
|
+
getEras() {
|
|
1445
|
+
return $4c8188d4ddf4ec96$var$ERA_NAMES;
|
|
2230
1446
|
}
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
1447
|
+
getYearsInEra(date) {
|
|
1448
|
+
// Get the number of years in the era, taking into account the date's month and day fields.
|
|
1449
|
+
let era = $4c8188d4ddf4ec96$var$ERA_NAMES.indexOf(date.era);
|
|
1450
|
+
let next = $4c8188d4ddf4ec96$var$ERA_START_DATES[era + 1];
|
|
1451
|
+
if (next == null) return 9999;
|
|
1452
|
+
let cur = $4c8188d4ddf4ec96$var$ERA_START_DATES[era];
|
|
1453
|
+
let years = next[0] - cur[0];
|
|
1454
|
+
if (date.month < next[1] || date.month === next[1] && date.day < next[2]) years++;
|
|
1455
|
+
return years;
|
|
2238
1456
|
}
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
1457
|
+
getMinimumMonthInYear(date) {
|
|
1458
|
+
let start = $4c8188d4ddf4ec96$var$getMinimums(date);
|
|
1459
|
+
return start ? start[1] : 1;
|
|
1460
|
+
}
|
|
1461
|
+
getMinimumDayInMonth(date) {
|
|
1462
|
+
let start = $4c8188d4ddf4ec96$var$getMinimums(date);
|
|
1463
|
+
return start && date.month === start[1] ? start[2] : 1;
|
|
1464
|
+
}
|
|
1465
|
+
constructor(...args){
|
|
1466
|
+
super(...args);
|
|
1467
|
+
this.identifier = 'japanese';
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
1470
|
+
function $4c8188d4ddf4ec96$var$getMinimums(date) {
|
|
1471
|
+
if (date.year === 1) {
|
|
1472
|
+
let idx = $4c8188d4ddf4ec96$var$ERA_NAMES.indexOf(date.era);
|
|
1473
|
+
return $4c8188d4ddf4ec96$var$ERA_START_DATES[idx];
|
|
2246
1474
|
}
|
|
2247
|
-
|
|
2248
|
-
return $a989b48226b9ac44fe33c05c41f3b63$var$umalquraYearLength(date.year);
|
|
2249
|
-
}
|
|
2250
|
-
|
|
2251
1475
|
}
|
|
2252
1476
|
|
|
2253
|
-
exports.IslamicUmalquraCalendar = IslamicUmalquraCalendar;
|
|
2254
|
-
const $cc2b03afe24b76b3bf6ec565767e7$var$HEBREW_EPOCH = 347997; // Hebrew date calculations are performed in terms of days, hours, and
|
|
2255
|
-
// "parts" (or halakim), which are 1/1080 of an hour, or 3 1/3 seconds.
|
|
2256
|
-
|
|
2257
|
-
const $cc2b03afe24b76b3bf6ec565767e7$var$HOUR_PARTS = 1080;
|
|
2258
|
-
const $cc2b03afe24b76b3bf6ec565767e7$var$DAY_PARTS = 24 * $cc2b03afe24b76b3bf6ec565767e7$var$HOUR_PARTS; // An approximate value for the length of a lunar month.
|
|
2259
|
-
// It is used to calculate the approximate year and month of a given
|
|
2260
|
-
// absolute date.
|
|
2261
|
-
|
|
2262
|
-
const $cc2b03afe24b76b3bf6ec565767e7$var$MONTH_DAYS = 29;
|
|
2263
|
-
const $cc2b03afe24b76b3bf6ec565767e7$var$MONTH_FRACT = 12 * $cc2b03afe24b76b3bf6ec565767e7$var$HOUR_PARTS + 793;
|
|
2264
|
-
const $cc2b03afe24b76b3bf6ec565767e7$var$MONTH_PARTS = $cc2b03afe24b76b3bf6ec565767e7$var$MONTH_DAYS * $cc2b03afe24b76b3bf6ec565767e7$var$DAY_PARTS + $cc2b03afe24b76b3bf6ec565767e7$var$MONTH_FRACT;
|
|
2265
|
-
|
|
2266
|
-
function $cc2b03afe24b76b3bf6ec565767e7$var$isLeapYear(year) {
|
|
2267
|
-
return $f839ba72fcd1ea0f3280c95c38c6e83$export$mod(year * 7 + 1, 19) < 7;
|
|
2268
|
-
} // Test for delay of start of new year and to avoid
|
|
2269
|
-
// Sunday, Wednesday, and Friday as start of the new year.
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
function $cc2b03afe24b76b3bf6ec565767e7$var$hebrewDelay1(year) {
|
|
2273
|
-
let months = Math.floor((235 * year - 234) / 19);
|
|
2274
|
-
let parts = 12084 + 13753 * months;
|
|
2275
|
-
let day = months * 29 + Math.floor(parts / 25920);
|
|
2276
1477
|
|
|
2277
|
-
if ($f839ba72fcd1ea0f3280c95c38c6e83$export$mod(3 * (day + 1), 7) < 3) {
|
|
2278
|
-
day += 1;
|
|
2279
|
-
}
|
|
2280
1478
|
|
|
2281
|
-
return day;
|
|
2282
|
-
} // Check for delay in start of new year due to length of adjacent years
|
|
2283
1479
|
|
|
1480
|
+
const $b20daff49d96eb86$var$BUDDHIST_ERA_START = -543;
|
|
1481
|
+
class $b20daff49d96eb86$export$42d20a78301dee44 extends $5adb4cba079e6f7b$export$80ee6245ec4f29ec {
|
|
1482
|
+
fromJulianDay(jd) {
|
|
1483
|
+
let date = super.fromJulianDay(jd);
|
|
1484
|
+
date.year -= $b20daff49d96eb86$var$BUDDHIST_ERA_START;
|
|
1485
|
+
return date;
|
|
1486
|
+
}
|
|
1487
|
+
toJulianDay(date) {
|
|
1488
|
+
return super.toJulianDay(new $9bb5411e4ba634f9$export$99faa760c7908e4f(date.year + $b20daff49d96eb86$var$BUDDHIST_ERA_START, date.month, date.day));
|
|
1489
|
+
}
|
|
1490
|
+
getEras() {
|
|
1491
|
+
return [
|
|
1492
|
+
'BE'
|
|
1493
|
+
];
|
|
1494
|
+
}
|
|
1495
|
+
constructor(...args){
|
|
1496
|
+
super(...args);
|
|
1497
|
+
this.identifier = 'buddhist';
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
2284
1500
|
|
|
2285
|
-
function $cc2b03afe24b76b3bf6ec565767e7$var$hebrewDelay2(year) {
|
|
2286
|
-
let last = $cc2b03afe24b76b3bf6ec565767e7$var$hebrewDelay1(year - 1);
|
|
2287
|
-
let present = $cc2b03afe24b76b3bf6ec565767e7$var$hebrewDelay1(year);
|
|
2288
|
-
let next = $cc2b03afe24b76b3bf6ec565767e7$var$hebrewDelay1(year + 1);
|
|
2289
1501
|
|
|
2290
|
-
if (next - present === 356) {
|
|
2291
|
-
return 2;
|
|
2292
|
-
}
|
|
2293
1502
|
|
|
2294
|
-
if (present - last === 382) {
|
|
2295
|
-
return 1;
|
|
2296
|
-
}
|
|
2297
1503
|
|
|
2298
|
-
|
|
1504
|
+
const $0034fbb09326c982$var$TAIWAN_ERA_START = 1911;
|
|
1505
|
+
function $0034fbb09326c982$var$gregorianYear(date) {
|
|
1506
|
+
return date.era === 'minguo' ? date.year + $0034fbb09326c982$var$TAIWAN_ERA_START : 1 - date.year + $0034fbb09326c982$var$TAIWAN_ERA_START;
|
|
2299
1507
|
}
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
1508
|
+
function $0034fbb09326c982$var$gregorianToTaiwan(year, date) {
|
|
1509
|
+
let y = year - $0034fbb09326c982$var$TAIWAN_ERA_START;
|
|
1510
|
+
if (y > 0) {
|
|
1511
|
+
date.era = 'minguo';
|
|
1512
|
+
date.year = y;
|
|
1513
|
+
} else {
|
|
1514
|
+
date.era = 'before_minguo';
|
|
1515
|
+
date.year = 1 - y;
|
|
1516
|
+
}
|
|
2303
1517
|
}
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
1518
|
+
class $0034fbb09326c982$export$65e01080afcb0799 extends $5adb4cba079e6f7b$export$80ee6245ec4f29ec {
|
|
1519
|
+
fromJulianDay(jd) {
|
|
1520
|
+
let date = super.fromJulianDay(jd);
|
|
1521
|
+
$0034fbb09326c982$var$gregorianToTaiwan(date.year, date);
|
|
1522
|
+
return date;
|
|
1523
|
+
}
|
|
1524
|
+
toJulianDay(date) {
|
|
1525
|
+
return super.toJulianDay(new $9bb5411e4ba634f9$export$99faa760c7908e4f($0034fbb09326c982$var$gregorianYear(date), date.month, date.day));
|
|
1526
|
+
}
|
|
1527
|
+
getEras() {
|
|
1528
|
+
return [
|
|
1529
|
+
'before_minguo',
|
|
1530
|
+
'minguo'
|
|
1531
|
+
];
|
|
1532
|
+
}
|
|
1533
|
+
balanceDate(date) {
|
|
1534
|
+
$0034fbb09326c982$var$gregorianToTaiwan($0034fbb09326c982$var$gregorianYear(date), date);
|
|
1535
|
+
}
|
|
1536
|
+
getYearsToAdd(date, years) {
|
|
1537
|
+
return date.era === 'before_minguo' ? -years : years;
|
|
1538
|
+
}
|
|
1539
|
+
constructor(...args){
|
|
1540
|
+
super(...args);
|
|
1541
|
+
this.identifier // Republic of China
|
|
1542
|
+
= 'roc';
|
|
1543
|
+
}
|
|
2307
1544
|
}
|
|
2308
1545
|
|
|
2309
|
-
function $cc2b03afe24b76b3bf6ec565767e7$var$getYearType(year) {
|
|
2310
|
-
let yearLength = $cc2b03afe24b76b3bf6ec565767e7$var$getDaysInYear(year);
|
|
2311
1546
|
|
|
2312
|
-
if (yearLength > 380) {
|
|
2313
|
-
yearLength -= 30; // Subtract length of leap month.
|
|
2314
|
-
}
|
|
2315
1547
|
|
|
2316
|
-
switch (yearLength) {
|
|
2317
|
-
case 353:
|
|
2318
|
-
return 0;
|
|
2319
|
-
// deficient
|
|
2320
1548
|
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
return 2;
|
|
2327
|
-
// complete
|
|
2328
|
-
}
|
|
1549
|
+
const $cae8dbfeeb52b26c$var$PERSIAN_EPOCH = 1948321; // 622/03/19 Julian C.E.
|
|
1550
|
+
function $cae8dbfeeb52b26c$var$isLeapYear(year) {
|
|
1551
|
+
let y0 = year > 0 ? year - 474 : year - 473;
|
|
1552
|
+
let y1 = $4ac4a53a5fa3b797$export$842a2cf37af977e1(y0, 2820) + 474;
|
|
1553
|
+
return $4ac4a53a5fa3b797$export$842a2cf37af977e1((y1 + 38) * 31, 128) < 31;
|
|
2329
1554
|
}
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
} // First of all, dispose of fixed-length 29 day months
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
if (month === 4 || month === 7 || month === 9 || month === 11 || month === 13) {
|
|
2339
|
-
return 29;
|
|
2340
|
-
}
|
|
2341
|
-
|
|
2342
|
-
let yearType = $cc2b03afe24b76b3bf6ec565767e7$var$getYearType(year); // If it's Heshvan, days depend on length of year
|
|
2343
|
-
|
|
2344
|
-
if (month === 2) {
|
|
2345
|
-
return yearType === 2 ? 30 : 29;
|
|
2346
|
-
} // Similarly, Kislev varies with the length of year
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
if (month === 3) {
|
|
2350
|
-
return yearType === 0 ? 29 : 30;
|
|
2351
|
-
} // Adar I only exists in leap years
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
if (month === 6) {
|
|
2355
|
-
return $cc2b03afe24b76b3bf6ec565767e7$var$isLeapYear(year) ? 30 : 0;
|
|
2356
|
-
}
|
|
2357
|
-
|
|
2358
|
-
return 30;
|
|
1555
|
+
function $cae8dbfeeb52b26c$var$persianToJulianDay(year, month, day) {
|
|
1556
|
+
let y0 = year > 0 ? year - 474 : year - 473;
|
|
1557
|
+
let y1 = $4ac4a53a5fa3b797$export$842a2cf37af977e1(y0, 2820) + 474;
|
|
1558
|
+
let offset = month <= 7 ? 31 * (month - 1) : 30 * (month - 1) + 6;
|
|
1559
|
+
return $cae8dbfeeb52b26c$var$PERSIAN_EPOCH - 1 + 1029983 * Math.floor(y0 / 2820) + 365 * (y1 - 1) + Math.floor((31 * y1 - 5) / 128) + offset + day;
|
|
2359
1560
|
}
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
let ys = $cc2b03afe24b76b3bf6ec565767e7$var$startOfYear(year); // 1st day of year
|
|
2373
|
-
|
|
2374
|
-
let dayOfYear = Math.floor(d - ys); // Because of the postponement rules, it's possible to guess wrong. Fix it.
|
|
2375
|
-
|
|
2376
|
-
while (dayOfYear < 1) {
|
|
2377
|
-
year--;
|
|
2378
|
-
ys = $cc2b03afe24b76b3bf6ec565767e7$var$startOfYear(year);
|
|
2379
|
-
dayOfYear = Math.floor(d - ys);
|
|
2380
|
-
} // Now figure out which month we're in, and the date within that month
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
let month = 1;
|
|
2384
|
-
let monthStart = 0;
|
|
2385
|
-
|
|
2386
|
-
while (monthStart < dayOfYear) {
|
|
2387
|
-
monthStart += $cc2b03afe24b76b3bf6ec565767e7$var$getDaysInMonth(year, month);
|
|
2388
|
-
month++;
|
|
1561
|
+
class $cae8dbfeeb52b26c$export$37fccdbfd14c5939 {
|
|
1562
|
+
fromJulianDay(jd) {
|
|
1563
|
+
let d0 = jd - $cae8dbfeeb52b26c$var$persianToJulianDay(475, 1, 1);
|
|
1564
|
+
let n2820 = Math.floor(d0 / 1029983);
|
|
1565
|
+
let d1 = $4ac4a53a5fa3b797$export$842a2cf37af977e1(d0, 1029983);
|
|
1566
|
+
let y2820 = d1 === 1029982 ? 2820 : Math.floor((128 * d1 + 46878) / 46751);
|
|
1567
|
+
let year = 474 + 2820 * n2820 + y2820;
|
|
1568
|
+
if (year <= 0) year--;
|
|
1569
|
+
let yDay = jd - $cae8dbfeeb52b26c$var$persianToJulianDay(year, 1, 1) + 1;
|
|
1570
|
+
let month = yDay <= 186 ? Math.ceil(yDay / 31) : Math.ceil((yDay - 6) / 31);
|
|
1571
|
+
let day = jd - $cae8dbfeeb52b26c$var$persianToJulianDay(year, month, 1) + 1;
|
|
1572
|
+
return new $9bb5411e4ba634f9$export$99faa760c7908e4f(this, year, month, day);
|
|
2389
1573
|
}
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
monthStart -= $cc2b03afe24b76b3bf6ec565767e7$var$getDaysInMonth(year, month);
|
|
2393
|
-
let day = dayOfYear - monthStart;
|
|
2394
|
-
return new CalendarDate(this, year, month, day);
|
|
2395
|
-
}
|
|
2396
|
-
|
|
2397
|
-
toJulianDay(date) {
|
|
2398
|
-
let jd = $cc2b03afe24b76b3bf6ec565767e7$var$startOfYear(date.year);
|
|
2399
|
-
|
|
2400
|
-
for (let month = 1; month < date.month; month++) {
|
|
2401
|
-
jd += $cc2b03afe24b76b3bf6ec565767e7$var$getDaysInMonth(date.year, month);
|
|
1574
|
+
toJulianDay(date) {
|
|
1575
|
+
return $cae8dbfeeb52b26c$var$persianToJulianDay(date.year, date.month, date.day);
|
|
2402
1576
|
}
|
|
1577
|
+
getMonthsInYear() {
|
|
1578
|
+
return 12;
|
|
1579
|
+
}
|
|
1580
|
+
getDaysInMonth(date) {
|
|
1581
|
+
if (date.month <= 6) return 31;
|
|
1582
|
+
if (date.month <= 11) return 30;
|
|
1583
|
+
return $cae8dbfeeb52b26c$var$isLeapYear(date.year) ? 30 : 29;
|
|
1584
|
+
}
|
|
1585
|
+
getEras() {
|
|
1586
|
+
return [
|
|
1587
|
+
'AP'
|
|
1588
|
+
];
|
|
1589
|
+
}
|
|
1590
|
+
getYearsInEra() {
|
|
1591
|
+
return 9999;
|
|
1592
|
+
}
|
|
1593
|
+
constructor(){
|
|
1594
|
+
this.identifier = 'persian';
|
|
1595
|
+
}
|
|
1596
|
+
}
|
|
2403
1597
|
|
|
2404
|
-
return jd + date.day + $cc2b03afe24b76b3bf6ec565767e7$var$HEBREW_EPOCH;
|
|
2405
|
-
}
|
|
2406
|
-
|
|
2407
|
-
getDaysInMonth(date) {
|
|
2408
|
-
return $cc2b03afe24b76b3bf6ec565767e7$var$getDaysInMonth(date.year, date.month);
|
|
2409
|
-
}
|
|
2410
|
-
|
|
2411
|
-
getMonthsInYear(date) {
|
|
2412
|
-
return $cc2b03afe24b76b3bf6ec565767e7$var$isLeapYear(date.year) ? 13 : 12;
|
|
2413
|
-
}
|
|
2414
|
-
|
|
2415
|
-
getDaysInYear(date) {
|
|
2416
|
-
return $cc2b03afe24b76b3bf6ec565767e7$var$getDaysInYear(date.year);
|
|
2417
|
-
}
|
|
2418
1598
|
|
|
2419
|
-
getYearsInEra() {
|
|
2420
|
-
return 9999;
|
|
2421
|
-
}
|
|
2422
1599
|
|
|
2423
|
-
getEras() {
|
|
2424
|
-
return ['AM'];
|
|
2425
|
-
}
|
|
2426
1600
|
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
date
|
|
2434
|
-
|
|
1601
|
+
// Starts in 78 AD,
|
|
1602
|
+
const $8f8e08f6046dcac2$var$INDIAN_ERA_START = 78;
|
|
1603
|
+
// The Indian year starts 80 days later than the Gregorian year.
|
|
1604
|
+
const $8f8e08f6046dcac2$var$INDIAN_YEAR_START = 80;
|
|
1605
|
+
class $8f8e08f6046dcac2$export$39f31c639fa15726 extends $5adb4cba079e6f7b$export$80ee6245ec4f29ec {
|
|
1606
|
+
fromJulianDay(jd) {
|
|
1607
|
+
// Gregorian date for Julian day
|
|
1608
|
+
let date = super.fromJulianDay(jd);
|
|
1609
|
+
// Year in Saka era
|
|
1610
|
+
let indianYear = date.year - $8f8e08f6046dcac2$var$INDIAN_ERA_START;
|
|
1611
|
+
// Day number in Gregorian year (starting from 0)
|
|
1612
|
+
let yDay = jd - $5adb4cba079e6f7b$export$f297eb839006d339(date.year, 1, 1);
|
|
1613
|
+
let leapMonth;
|
|
1614
|
+
if (yDay < $8f8e08f6046dcac2$var$INDIAN_YEAR_START) {
|
|
1615
|
+
// Day is at the end of the preceding Saka year
|
|
1616
|
+
indianYear--;
|
|
1617
|
+
// Days in leapMonth this year, previous Gregorian year
|
|
1618
|
+
leapMonth = $5adb4cba079e6f7b$export$553d7fa8e3805fc0(date.year - 1) ? 31 : 30;
|
|
1619
|
+
yDay += leapMonth + 155 + 90 + 10;
|
|
1620
|
+
} else {
|
|
1621
|
+
// Days in leapMonth this year
|
|
1622
|
+
leapMonth = $5adb4cba079e6f7b$export$553d7fa8e3805fc0(date.year) ? 31 : 30;
|
|
1623
|
+
yDay -= $8f8e08f6046dcac2$var$INDIAN_YEAR_START;
|
|
1624
|
+
}
|
|
1625
|
+
let indianMonth;
|
|
1626
|
+
let indianDay;
|
|
1627
|
+
if (yDay < leapMonth) {
|
|
1628
|
+
indianMonth = 1;
|
|
1629
|
+
indianDay = yDay + 1;
|
|
1630
|
+
} else {
|
|
1631
|
+
let mDay = yDay - leapMonth;
|
|
1632
|
+
if (mDay < 155) {
|
|
1633
|
+
indianMonth = Math.floor(mDay / 31) + 2;
|
|
1634
|
+
indianDay = mDay % 31 + 1;
|
|
1635
|
+
} else {
|
|
1636
|
+
mDay -= 155;
|
|
1637
|
+
indianMonth = Math.floor(mDay / 30) + 7;
|
|
1638
|
+
indianDay = mDay % 30 + 1;
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
return new $9bb5411e4ba634f9$export$99faa760c7908e4f(this, indianYear, indianMonth, indianDay);
|
|
1642
|
+
}
|
|
1643
|
+
toJulianDay(date) {
|
|
1644
|
+
let year = date.year + $8f8e08f6046dcac2$var$INDIAN_ERA_START;
|
|
1645
|
+
let leapMonth;
|
|
1646
|
+
let jd;
|
|
1647
|
+
if ($5adb4cba079e6f7b$export$553d7fa8e3805fc0(year)) {
|
|
1648
|
+
leapMonth = 31;
|
|
1649
|
+
jd = $5adb4cba079e6f7b$export$f297eb839006d339(year, 3, 21);
|
|
1650
|
+
} else {
|
|
1651
|
+
leapMonth = 30;
|
|
1652
|
+
jd = $5adb4cba079e6f7b$export$f297eb839006d339(year, 3, 22);
|
|
1653
|
+
}
|
|
1654
|
+
if (date.month === 1) return jd + date.day - 1;
|
|
1655
|
+
jd += leapMonth + Math.min(date.month - 2, 5) * 31;
|
|
1656
|
+
if (date.month >= 8) jd += (date.month - 7) * 30;
|
|
1657
|
+
jd += date.day - 1;
|
|
1658
|
+
return jd;
|
|
1659
|
+
}
|
|
1660
|
+
getDaysInMonth(date) {
|
|
1661
|
+
if (date.month === 1 && $5adb4cba079e6f7b$export$553d7fa8e3805fc0(date.year + $8f8e08f6046dcac2$var$INDIAN_ERA_START)) return 31;
|
|
1662
|
+
if (date.month >= 2 && date.month <= 6) return 31;
|
|
1663
|
+
return 30;
|
|
1664
|
+
}
|
|
1665
|
+
getYearsInEra() {
|
|
1666
|
+
return 9999;
|
|
1667
|
+
}
|
|
1668
|
+
getEras() {
|
|
1669
|
+
return [
|
|
1670
|
+
'saka'
|
|
1671
|
+
];
|
|
1672
|
+
}
|
|
1673
|
+
constructor(...args){
|
|
1674
|
+
super(...args);
|
|
1675
|
+
this.identifier = 'indian';
|
|
2435
1676
|
}
|
|
2436
|
-
}
|
|
2437
|
-
|
|
2438
1677
|
}
|
|
2439
1678
|
|
|
2440
|
-
exports.HebrewCalendar = HebrewCalendar;
|
|
2441
|
-
const $e97ab861d6249e3f231cf864175fa721$var$ETHIOPIC_EPOCH = 1723856;
|
|
2442
|
-
const $e97ab861d6249e3f231cf864175fa721$var$COPTIC_EPOCH = 1824665; // The delta between Amete Alem 1 and Amete Mihret 1
|
|
2443
|
-
// AA 5501 = AM 1
|
|
2444
1679
|
|
|
2445
|
-
const $e97ab861d6249e3f231cf864175fa721$var$AMETE_MIHRET_DELTA = 5500;
|
|
2446
1680
|
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
1681
|
+
const $8ba87b21dd897347$var$CIVIL_EPOC = 1948440; // CE 622 July 16 Friday (Julian calendar) / CE 622 July 19 (Gregorian calendar)
|
|
1682
|
+
const $8ba87b21dd897347$var$ASTRONOMICAL_EPOC = 1948439; // CE 622 July 15 Thursday (Julian calendar)
|
|
1683
|
+
const $8ba87b21dd897347$var$UMALQURA_YEAR_START = 1300;
|
|
1684
|
+
const $8ba87b21dd897347$var$UMALQURA_YEAR_END = 1600;
|
|
1685
|
+
const $8ba87b21dd897347$var$UMALQURA_START_DAYS = 460322;
|
|
1686
|
+
function $8ba87b21dd897347$var$islamicToJulianDay(epoch, year, month, day) {
|
|
1687
|
+
return day + Math.ceil(29.5 * (month - 1)) + (year - 1) * 354 + Math.floor((3 + 11 * year) / 30) + epoch - 1;
|
|
2452
1688
|
}
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
return new CalendarDate(calendar, year, month, day);
|
|
1689
|
+
function $8ba87b21dd897347$var$julianDayToIslamic(calendar, epoch, jd) {
|
|
1690
|
+
let year = Math.floor((30 * (jd - epoch) + 10646) / 10631);
|
|
1691
|
+
let month = Math.min(12, Math.ceil((jd - (29 + $8ba87b21dd897347$var$islamicToJulianDay(epoch, year, 1, 1))) / 29.5) + 1);
|
|
1692
|
+
let day = jd - $8ba87b21dd897347$var$islamicToJulianDay(epoch, year, month, 1) + 1;
|
|
1693
|
+
return new $9bb5411e4ba634f9$export$99faa760c7908e4f(calendar, year, month, day);
|
|
2459
1694
|
}
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
return Math.floor(year % 4 / 3);
|
|
1695
|
+
function $8ba87b21dd897347$var$isLeapYear(year) {
|
|
1696
|
+
return (14 + 11 * year) % 30 < 11;
|
|
2463
1697
|
}
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
1698
|
+
class $8ba87b21dd897347$export$2066795aadd37bfc {
|
|
1699
|
+
fromJulianDay(jd) {
|
|
1700
|
+
return $8ba87b21dd897347$var$julianDayToIslamic(this, $8ba87b21dd897347$var$CIVIL_EPOC, jd);
|
|
1701
|
+
}
|
|
1702
|
+
toJulianDay(date) {
|
|
1703
|
+
return $8ba87b21dd897347$var$islamicToJulianDay($8ba87b21dd897347$var$CIVIL_EPOC, date.year, date.month, date.day);
|
|
1704
|
+
}
|
|
1705
|
+
getDaysInMonth(date) {
|
|
1706
|
+
let length = 29 + date.month % 2;
|
|
1707
|
+
if (date.month === 12 && $8ba87b21dd897347$var$isLeapYear(date.year)) length++;
|
|
1708
|
+
return length;
|
|
1709
|
+
}
|
|
1710
|
+
getMonthsInYear() {
|
|
1711
|
+
return 12;
|
|
1712
|
+
}
|
|
1713
|
+
getDaysInYear(date) {
|
|
1714
|
+
return $8ba87b21dd897347$var$isLeapYear(date.year) ? 355 : 354;
|
|
1715
|
+
}
|
|
1716
|
+
getYearsInEra() {
|
|
1717
|
+
return 9999;
|
|
1718
|
+
}
|
|
1719
|
+
getEras() {
|
|
1720
|
+
return [
|
|
1721
|
+
'AH'
|
|
1722
|
+
];
|
|
1723
|
+
}
|
|
1724
|
+
constructor(){
|
|
1725
|
+
this.identifier = 'islamic-civil';
|
|
1726
|
+
}
|
|
2478
1727
|
}
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
this.identifier = 'ethiopic';
|
|
2483
|
-
}
|
|
2484
|
-
|
|
2485
|
-
fromJulianDay(jd) {
|
|
2486
|
-
let date = $e97ab861d6249e3f231cf864175fa721$var$julianDayToCE(this, $e97ab861d6249e3f231cf864175fa721$var$ETHIOPIC_EPOCH, jd);
|
|
2487
|
-
|
|
2488
|
-
if (date.year > 0) {
|
|
2489
|
-
date.era = 'AM';
|
|
2490
|
-
} else {
|
|
2491
|
-
date.era = 'AA';
|
|
2492
|
-
date.year += $e97ab861d6249e3f231cf864175fa721$var$AMETE_MIHRET_DELTA;
|
|
1728
|
+
class $8ba87b21dd897347$export$37f0887f2f9d22f7 extends $8ba87b21dd897347$export$2066795aadd37bfc {
|
|
1729
|
+
fromJulianDay(jd) {
|
|
1730
|
+
return $8ba87b21dd897347$var$julianDayToIslamic(this, $8ba87b21dd897347$var$ASTRONOMICAL_EPOC, jd);
|
|
2493
1731
|
}
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
}
|
|
2497
|
-
|
|
2498
|
-
toJulianDay(date) {
|
|
2499
|
-
let year = date.year;
|
|
2500
|
-
|
|
2501
|
-
if (date.era === 'AA') {
|
|
2502
|
-
year -= $e97ab861d6249e3f231cf864175fa721$var$AMETE_MIHRET_DELTA;
|
|
1732
|
+
toJulianDay(date) {
|
|
1733
|
+
return $8ba87b21dd897347$var$islamicToJulianDay($8ba87b21dd897347$var$ASTRONOMICAL_EPOC, date.year, date.month, date.day);
|
|
2503
1734
|
}
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
getDaysInMonth(date) {
|
|
2509
|
-
let year = date.year;
|
|
2510
|
-
|
|
2511
|
-
if (date.era === 'AA') {
|
|
2512
|
-
year -= $e97ab861d6249e3f231cf864175fa721$var$AMETE_MIHRET_DELTA;
|
|
1735
|
+
constructor(...args){
|
|
1736
|
+
super(...args);
|
|
1737
|
+
this.identifier = 'islamic-tbla';
|
|
2513
1738
|
}
|
|
2514
|
-
|
|
2515
|
-
return $e97ab861d6249e3f231cf864175fa721$var$getDaysInMonth(year, date.month);
|
|
2516
|
-
}
|
|
2517
|
-
|
|
2518
|
-
getMonthsInYear() {
|
|
2519
|
-
return 13;
|
|
2520
|
-
}
|
|
2521
|
-
|
|
2522
|
-
getDaysInYear(date) {
|
|
2523
|
-
return 365 + $e97ab861d6249e3f231cf864175fa721$var$getLeapDay(date.year);
|
|
2524
|
-
}
|
|
2525
|
-
|
|
2526
|
-
getYearsInEra() {
|
|
2527
|
-
return 9999;
|
|
2528
|
-
}
|
|
2529
|
-
|
|
2530
|
-
getEras() {
|
|
2531
|
-
return ['AA', 'AM'];
|
|
2532
|
-
}
|
|
2533
|
-
|
|
2534
1739
|
}
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
1740
|
+
// Generated by scripts/generate-umalqura.js
|
|
1741
|
+
const $8ba87b21dd897347$var$UMALQURA_DATA = 'qgpUDckO1AbqBmwDrQpVBakGkgepC9QF2gpcBS0NlQZKB1QLagutBa4ETwoXBYsGpQbVCtYCWwmdBE0KJg2VDawFtgm6AlsKKwWVCsoG6Qr0AnYJtgJWCcoKpAvSC9kF3AJtCU0FpQpSC6ULtAW2CVcFlwJLBaMGUgdlC2oFqworBZUMSg2lDcoF1gpXCasESwmlClILagt1BXYCtwhbBFUFqQW0BdoJ3QRuAjYJqgpUDbIN1QXaAlsJqwRVCkkLZAtxC7QFtQpVCiUNkg7JDtQG6QprCasEkwpJDaQNsg25CroEWworBZUKKgtVC1wFvQQ9Ah0JlQpKC1oLbQW2AjsJmwRVBqkGVAdqC2wFrQpVBSkLkgupC9QF2gpaBasKlQVJB2QHqgu1BbYCVgpNDiULUgtqC60FrgIvCZcESwalBqwG1gpdBZ0ETQoWDZUNqgW1BdoCWwmtBJUFygbkBuoK9QS2AlYJqgpUC9IL2QXqAm0JrQSVCkoLpQuyBbUJ1gSXCkcFkwZJB1ULagVrCisFiwpGDaMNygXWCtsEawJLCaUKUgtpC3UFdgG3CFsCKwVlBbQF2gntBG0BtgimClINqQ3UBdoKWwmrBFMGKQdiB6kLsgW1ClUFJQuSDckO0gbpCmsFqwRVCikNVA2qDbUJugQ7CpsETQqqCtUK2gJdCV4ELgqaDFUNsga5BroEXQotBZUKUguoC7QLuQXaAloJSgukDdEO6AZqC20FNQWVBkoNqA3UDdoGWwWdAisGFQtKC5ULqgWuCi4JjwwnBZUGqgbWCl0FnQI=';
|
|
1742
|
+
let $8ba87b21dd897347$var$UMALQURA_MONTHLENGTH;
|
|
1743
|
+
let $8ba87b21dd897347$var$UMALQURA_YEAR_START_TABLE;
|
|
1744
|
+
function $8ba87b21dd897347$var$umalquraYearStart(year) {
|
|
1745
|
+
return $8ba87b21dd897347$var$UMALQURA_START_DAYS + $8ba87b21dd897347$var$UMALQURA_YEAR_START_TABLE[year - $8ba87b21dd897347$var$UMALQURA_YEAR_START];
|
|
1746
|
+
}
|
|
1747
|
+
function $8ba87b21dd897347$var$umalquraMonthLength(year, month) {
|
|
1748
|
+
let idx = year - $8ba87b21dd897347$var$UMALQURA_YEAR_START;
|
|
1749
|
+
let mask = 1 << 11 - (month - 1);
|
|
1750
|
+
if (($8ba87b21dd897347$var$UMALQURA_MONTHLENGTH[idx] & mask) === 0) return 29;
|
|
1751
|
+
else return 30;
|
|
1752
|
+
}
|
|
1753
|
+
function $8ba87b21dd897347$var$umalquraMonthStart(year, month) {
|
|
1754
|
+
let day = $8ba87b21dd897347$var$umalquraYearStart(year);
|
|
1755
|
+
for(let i = 1; i < month; i++)day += $8ba87b21dd897347$var$umalquraMonthLength(year, i);
|
|
1756
|
+
return day;
|
|
1757
|
+
}
|
|
1758
|
+
function $8ba87b21dd897347$var$umalquraYearLength(year) {
|
|
1759
|
+
return $8ba87b21dd897347$var$UMALQURA_YEAR_START_TABLE[year + 1 - $8ba87b21dd897347$var$UMALQURA_YEAR_START] - $8ba87b21dd897347$var$UMALQURA_YEAR_START_TABLE[year - $8ba87b21dd897347$var$UMALQURA_YEAR_START];
|
|
1760
|
+
}
|
|
1761
|
+
class $8ba87b21dd897347$export$5baab4758c231076 extends $8ba87b21dd897347$export$2066795aadd37bfc {
|
|
1762
|
+
constructor(){
|
|
1763
|
+
super();
|
|
1764
|
+
this.identifier = 'islamic-umalqura';
|
|
1765
|
+
if (!$8ba87b21dd897347$var$UMALQURA_MONTHLENGTH) $8ba87b21dd897347$var$UMALQURA_MONTHLENGTH = new Uint16Array(Uint8Array.from(atob($8ba87b21dd897347$var$UMALQURA_DATA), (c)=>c.charCodeAt(0)
|
|
1766
|
+
).buffer);
|
|
1767
|
+
if (!$8ba87b21dd897347$var$UMALQURA_YEAR_START_TABLE) {
|
|
1768
|
+
$8ba87b21dd897347$var$UMALQURA_YEAR_START_TABLE = new Uint32Array($8ba87b21dd897347$var$UMALQURA_YEAR_END - $8ba87b21dd897347$var$UMALQURA_YEAR_START + 1);
|
|
1769
|
+
let yearStart = 0;
|
|
1770
|
+
for(let year = $8ba87b21dd897347$var$UMALQURA_YEAR_START; year <= $8ba87b21dd897347$var$UMALQURA_YEAR_END; year++){
|
|
1771
|
+
$8ba87b21dd897347$var$UMALQURA_YEAR_START_TABLE[year - $8ba87b21dd897347$var$UMALQURA_YEAR_START] = yearStart;
|
|
1772
|
+
for(let i = 1; i <= 12; i++)yearStart += $8ba87b21dd897347$var$umalquraMonthLength(year, i);
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
}
|
|
1776
|
+
fromJulianDay(jd) {
|
|
1777
|
+
let days = jd - $8ba87b21dd897347$var$CIVIL_EPOC;
|
|
1778
|
+
let startDays = $8ba87b21dd897347$var$umalquraYearStart($8ba87b21dd897347$var$UMALQURA_YEAR_START);
|
|
1779
|
+
let endDays = $8ba87b21dd897347$var$umalquraYearStart($8ba87b21dd897347$var$UMALQURA_YEAR_END);
|
|
1780
|
+
if (days < startDays || days > endDays) return super.fromJulianDay(jd);
|
|
1781
|
+
else {
|
|
1782
|
+
let y = $8ba87b21dd897347$var$UMALQURA_YEAR_START - 1;
|
|
1783
|
+
let m = 1;
|
|
1784
|
+
let d = 1;
|
|
1785
|
+
while(d > 0){
|
|
1786
|
+
y++;
|
|
1787
|
+
d = days - $8ba87b21dd897347$var$umalquraYearStart(y) + 1;
|
|
1788
|
+
let yearLength = $8ba87b21dd897347$var$umalquraYearLength(y);
|
|
1789
|
+
if (d === yearLength) {
|
|
1790
|
+
m = 12;
|
|
1791
|
+
break;
|
|
1792
|
+
} else if (d < yearLength) {
|
|
1793
|
+
let monthLength = $8ba87b21dd897347$var$umalquraMonthLength(y, m);
|
|
1794
|
+
m = 1;
|
|
1795
|
+
while(d > monthLength){
|
|
1796
|
+
d -= monthLength;
|
|
1797
|
+
m++;
|
|
1798
|
+
monthLength = $8ba87b21dd897347$var$umalquraMonthLength(y, m);
|
|
1799
|
+
}
|
|
1800
|
+
break;
|
|
1801
|
+
}
|
|
1802
|
+
}
|
|
1803
|
+
return new $9bb5411e4ba634f9$export$99faa760c7908e4f(this, y, m, days - $8ba87b21dd897347$var$umalquraMonthStart(y, m) + 1);
|
|
1804
|
+
}
|
|
1805
|
+
}
|
|
1806
|
+
toJulianDay(date) {
|
|
1807
|
+
if (date.year < $8ba87b21dd897347$var$UMALQURA_YEAR_START || date.year > $8ba87b21dd897347$var$UMALQURA_YEAR_END) return super.toJulianDay(date);
|
|
1808
|
+
return $8ba87b21dd897347$var$CIVIL_EPOC + $8ba87b21dd897347$var$umalquraMonthStart(date.year, date.month) + (date.day - 1);
|
|
1809
|
+
}
|
|
1810
|
+
getDaysInMonth(date) {
|
|
1811
|
+
if (date.year < $8ba87b21dd897347$var$UMALQURA_YEAR_START || date.year > $8ba87b21dd897347$var$UMALQURA_YEAR_END) return super.getDaysInMonth(date);
|
|
1812
|
+
return $8ba87b21dd897347$var$umalquraMonthLength(date.year, date.month);
|
|
1813
|
+
}
|
|
1814
|
+
getDaysInYear(date) {
|
|
1815
|
+
if (date.year < $8ba87b21dd897347$var$UMALQURA_YEAR_START || date.year > $8ba87b21dd897347$var$UMALQURA_YEAR_END) return super.getDaysInYear(date);
|
|
1816
|
+
return $8ba87b21dd897347$var$umalquraYearLength(date.year);
|
|
1817
|
+
}
|
|
2556
1818
|
}
|
|
2557
1819
|
|
|
2558
|
-
exports.EthiopicAmeteAlemCalendar = EthiopicAmeteAlemCalendar;
|
|
2559
1820
|
|
|
2560
|
-
class CopticCalendar extends EthiopicCalendar {
|
|
2561
|
-
constructor() {
|
|
2562
|
-
super(...arguments);
|
|
2563
|
-
this.identifier = 'coptic';
|
|
2564
|
-
}
|
|
2565
1821
|
|
|
2566
|
-
fromJulianDay(jd) {
|
|
2567
|
-
let date = $e97ab861d6249e3f231cf864175fa721$var$julianDayToCE(this, $e97ab861d6249e3f231cf864175fa721$var$COPTIC_EPOCH, jd);
|
|
2568
1822
|
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
1823
|
+
const $33f6c3bb549d8eee$var$HEBREW_EPOCH = 347997;
|
|
1824
|
+
// Hebrew date calculations are performed in terms of days, hours, and
|
|
1825
|
+
// "parts" (or halakim), which are 1/1080 of an hour, or 3 1/3 seconds.
|
|
1826
|
+
const $33f6c3bb549d8eee$var$HOUR_PARTS = 1080;
|
|
1827
|
+
const $33f6c3bb549d8eee$var$DAY_PARTS = 24 * $33f6c3bb549d8eee$var$HOUR_PARTS;
|
|
1828
|
+
// An approximate value for the length of a lunar month.
|
|
1829
|
+
// It is used to calculate the approximate year and month of a given
|
|
1830
|
+
// absolute date.
|
|
1831
|
+
const $33f6c3bb549d8eee$var$MONTH_DAYS = 29;
|
|
1832
|
+
const $33f6c3bb549d8eee$var$MONTH_FRACT = 12 * $33f6c3bb549d8eee$var$HOUR_PARTS + 793;
|
|
1833
|
+
const $33f6c3bb549d8eee$var$MONTH_PARTS = $33f6c3bb549d8eee$var$MONTH_DAYS * $33f6c3bb549d8eee$var$DAY_PARTS + $33f6c3bb549d8eee$var$MONTH_FRACT;
|
|
1834
|
+
function $33f6c3bb549d8eee$var$isLeapYear(year) {
|
|
1835
|
+
return $4ac4a53a5fa3b797$export$842a2cf37af977e1(year * 7 + 1, 19) < 7;
|
|
1836
|
+
}
|
|
1837
|
+
// Test for delay of start of new year and to avoid
|
|
1838
|
+
// Sunday, Wednesday, and Friday as start of the new year.
|
|
1839
|
+
function $33f6c3bb549d8eee$var$hebrewDelay1(year) {
|
|
1840
|
+
let months = Math.floor((235 * year - 234) / 19);
|
|
1841
|
+
let parts = 12084 + 13753 * months;
|
|
1842
|
+
let day = months * 29 + Math.floor(parts / 25920);
|
|
1843
|
+
if ($4ac4a53a5fa3b797$export$842a2cf37af977e1(3 * (day + 1), 7) < 3) day += 1;
|
|
1844
|
+
return day;
|
|
1845
|
+
}
|
|
1846
|
+
// Check for delay in start of new year due to length of adjacent years
|
|
1847
|
+
function $33f6c3bb549d8eee$var$hebrewDelay2(year) {
|
|
1848
|
+
let last = $33f6c3bb549d8eee$var$hebrewDelay1(year - 1);
|
|
1849
|
+
let present = $33f6c3bb549d8eee$var$hebrewDelay1(year);
|
|
1850
|
+
let next = $33f6c3bb549d8eee$var$hebrewDelay1(year + 1);
|
|
1851
|
+
if (next - present === 356) return 2;
|
|
1852
|
+
if (present - last === 382) return 1;
|
|
1853
|
+
return 0;
|
|
1854
|
+
}
|
|
1855
|
+
function $33f6c3bb549d8eee$var$startOfYear(year) {
|
|
1856
|
+
return $33f6c3bb549d8eee$var$hebrewDelay1(year) + $33f6c3bb549d8eee$var$hebrewDelay2(year);
|
|
1857
|
+
}
|
|
1858
|
+
function $33f6c3bb549d8eee$var$getDaysInYear(year) {
|
|
1859
|
+
return $33f6c3bb549d8eee$var$startOfYear(year + 1) - $33f6c3bb549d8eee$var$startOfYear(year);
|
|
1860
|
+
}
|
|
1861
|
+
function $33f6c3bb549d8eee$var$getYearType(year) {
|
|
1862
|
+
let yearLength = $33f6c3bb549d8eee$var$getDaysInYear(year);
|
|
1863
|
+
if (yearLength > 380) yearLength -= 30; // Subtract length of leap month.
|
|
1864
|
+
switch(yearLength){
|
|
1865
|
+
case 353:
|
|
1866
|
+
return 0; // deficient
|
|
1867
|
+
case 354:
|
|
1868
|
+
return 1; // normal
|
|
1869
|
+
case 355:
|
|
1870
|
+
return 2; // complete
|
|
2574
1871
|
}
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
1872
|
+
}
|
|
1873
|
+
function $33f6c3bb549d8eee$var$getDaysInMonth(year, month) {
|
|
1874
|
+
// Normalize month numbers from 1 - 13, even on non-leap years
|
|
1875
|
+
if (month >= 6 && !$33f6c3bb549d8eee$var$isLeapYear(year)) month++;
|
|
1876
|
+
// First of all, dispose of fixed-length 29 day months
|
|
1877
|
+
if (month === 4 || month === 7 || month === 9 || month === 11 || month === 13) return 29;
|
|
1878
|
+
let yearType = $33f6c3bb549d8eee$var$getYearType(year);
|
|
1879
|
+
// If it's Heshvan, days depend on length of year
|
|
1880
|
+
if (month === 2) return yearType === 2 ? 30 : 29;
|
|
1881
|
+
// Similarly, Kislev varies with the length of year
|
|
1882
|
+
if (month === 3) return yearType === 0 ? 29 : 30;
|
|
1883
|
+
// Adar I only exists in leap years
|
|
1884
|
+
if (month === 6) return $33f6c3bb549d8eee$var$isLeapYear(year) ? 30 : 0;
|
|
1885
|
+
return 30;
|
|
1886
|
+
}
|
|
1887
|
+
class $33f6c3bb549d8eee$export$ca405048b8fb5af {
|
|
1888
|
+
fromJulianDay(jd) {
|
|
1889
|
+
let d = jd - $33f6c3bb549d8eee$var$HEBREW_EPOCH;
|
|
1890
|
+
let m = d * $33f6c3bb549d8eee$var$DAY_PARTS / $33f6c3bb549d8eee$var$MONTH_PARTS; // Months (approx)
|
|
1891
|
+
let year = Math.floor((19 * m + 234) / 235) + 1; // Years (approx)
|
|
1892
|
+
let ys = $33f6c3bb549d8eee$var$startOfYear(year); // 1st day of year
|
|
1893
|
+
let dayOfYear = Math.floor(d - ys);
|
|
1894
|
+
// Because of the postponement rules, it's possible to guess wrong. Fix it.
|
|
1895
|
+
while(dayOfYear < 1){
|
|
1896
|
+
year--;
|
|
1897
|
+
ys = $33f6c3bb549d8eee$var$startOfYear(year);
|
|
1898
|
+
dayOfYear = Math.floor(d - ys);
|
|
1899
|
+
}
|
|
1900
|
+
// Now figure out which month we're in, and the date within that month
|
|
1901
|
+
let month = 1;
|
|
1902
|
+
let monthStart = 0;
|
|
1903
|
+
while(monthStart < dayOfYear){
|
|
1904
|
+
monthStart += $33f6c3bb549d8eee$var$getDaysInMonth(year, month);
|
|
1905
|
+
month++;
|
|
1906
|
+
}
|
|
1907
|
+
month--;
|
|
1908
|
+
monthStart -= $33f6c3bb549d8eee$var$getDaysInMonth(year, month);
|
|
1909
|
+
let day = dayOfYear - monthStart;
|
|
1910
|
+
return new $9bb5411e4ba634f9$export$99faa760c7908e4f(this, year, month, day);
|
|
2584
1911
|
}
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
1912
|
+
toJulianDay(date) {
|
|
1913
|
+
let jd = $33f6c3bb549d8eee$var$startOfYear(date.year);
|
|
1914
|
+
for(let month = 1; month < date.month; month++)jd += $33f6c3bb549d8eee$var$getDaysInMonth(date.year, month);
|
|
1915
|
+
return jd + date.day + $33f6c3bb549d8eee$var$HEBREW_EPOCH;
|
|
1916
|
+
}
|
|
1917
|
+
getDaysInMonth(date) {
|
|
1918
|
+
return $33f6c3bb549d8eee$var$getDaysInMonth(date.year, date.month);
|
|
1919
|
+
}
|
|
1920
|
+
getMonthsInYear(date) {
|
|
1921
|
+
return $33f6c3bb549d8eee$var$isLeapYear(date.year) ? 13 : 12;
|
|
1922
|
+
}
|
|
1923
|
+
getDaysInYear(date) {
|
|
1924
|
+
return $33f6c3bb549d8eee$var$getDaysInYear(date.year);
|
|
1925
|
+
}
|
|
1926
|
+
getYearsInEra() {
|
|
1927
|
+
return 9999;
|
|
1928
|
+
}
|
|
1929
|
+
getEras() {
|
|
1930
|
+
return [
|
|
1931
|
+
'AM'
|
|
1932
|
+
];
|
|
1933
|
+
}
|
|
1934
|
+
balanceYearMonth(date, previousDate) {
|
|
1935
|
+
// Keep date in the same month when switching between leap years and non leap years
|
|
1936
|
+
if (previousDate.year !== date.year) {
|
|
1937
|
+
if ($33f6c3bb549d8eee$var$isLeapYear(previousDate.year) && !$33f6c3bb549d8eee$var$isLeapYear(date.year) && previousDate.month > 6) date.month--;
|
|
1938
|
+
else if (!$33f6c3bb549d8eee$var$isLeapYear(previousDate.year) && $33f6c3bb549d8eee$var$isLeapYear(date.year) && previousDate.month > 6) date.month++;
|
|
1939
|
+
}
|
|
1940
|
+
}
|
|
1941
|
+
constructor(){
|
|
1942
|
+
this.identifier = 'hebrew';
|
|
2594
1943
|
}
|
|
2595
|
-
|
|
2596
|
-
return $e97ab861d6249e3f231cf864175fa721$var$getDaysInMonth(year, date.month);
|
|
2597
|
-
}
|
|
2598
|
-
|
|
2599
|
-
getYearsToAdd(date, years) {
|
|
2600
|
-
return date.era === 'BCE' ? -years : years;
|
|
2601
|
-
}
|
|
2602
|
-
|
|
2603
|
-
getEras() {
|
|
2604
|
-
return ['BCE', 'CE'];
|
|
2605
|
-
}
|
|
2606
|
-
|
|
2607
1944
|
}
|
|
2608
1945
|
|
|
2609
|
-
exports.CopticCalendar = CopticCalendar;
|
|
2610
|
-
|
|
2611
|
-
function createCalendar(name) {
|
|
2612
|
-
switch (name) {
|
|
2613
|
-
case 'buddhist':
|
|
2614
|
-
return new BuddhistCalendar();
|
|
2615
|
-
|
|
2616
|
-
case 'ethiopic':
|
|
2617
|
-
return new EthiopicCalendar();
|
|
2618
1946
|
|
|
2619
|
-
case 'ethioaa':
|
|
2620
|
-
return new EthiopicAmeteAlemCalendar();
|
|
2621
1947
|
|
|
2622
|
-
|
|
2623
|
-
|
|
1948
|
+
const $0e96efac8f672b88$var$ETHIOPIC_EPOCH = 1723856;
|
|
1949
|
+
const $0e96efac8f672b88$var$COPTIC_EPOCH = 1824665;
|
|
1950
|
+
// The delta between Amete Alem 1 and Amete Mihret 1
|
|
1951
|
+
// AA 5501 = AM 1
|
|
1952
|
+
const $0e96efac8f672b88$var$AMETE_MIHRET_DELTA = 5500;
|
|
1953
|
+
function $0e96efac8f672b88$var$ceToJulianDay(epoch, year, month, day) {
|
|
1954
|
+
return epoch // difference from Julian epoch to 1,1,1
|
|
1955
|
+
+ 365 * year // number of days from years
|
|
1956
|
+
+ Math.floor(year / 4) // extra day of leap year
|
|
1957
|
+
+ 30 * (month - 1) // number of days from months (1 based)
|
|
1958
|
+
+ day - 1 // number of days for present month (1 based)
|
|
1959
|
+
;
|
|
1960
|
+
}
|
|
1961
|
+
function $0e96efac8f672b88$var$julianDayToCE(calendar, epoch, jd) {
|
|
1962
|
+
let year = Math.floor(4 * (jd - epoch) / 1461);
|
|
1963
|
+
let month = 1 + Math.floor((jd - $0e96efac8f672b88$var$ceToJulianDay(epoch, year, 1, 1)) / 30);
|
|
1964
|
+
let day = jd + 1 - $0e96efac8f672b88$var$ceToJulianDay(epoch, year, month, 1);
|
|
1965
|
+
return new $9bb5411e4ba634f9$export$99faa760c7908e4f(calendar, year, month, day);
|
|
1966
|
+
}
|
|
1967
|
+
function $0e96efac8f672b88$var$getLeapDay(year) {
|
|
1968
|
+
return Math.floor(year % 4 / 3);
|
|
1969
|
+
}
|
|
1970
|
+
function $0e96efac8f672b88$var$getDaysInMonth(year, month) {
|
|
1971
|
+
// The Ethiopian and Coptic calendars have 13 months, 12 of 30 days each and
|
|
1972
|
+
// an intercalary month at the end of the year of 5 or 6 days, depending whether
|
|
1973
|
+
// the year is a leap year or not. The Leap Year follows the same rules as the
|
|
1974
|
+
// Julian Calendar so that the extra month always has six days in the year before
|
|
1975
|
+
// a Julian Leap Year.
|
|
1976
|
+
if (month % 13 !== 0) // not intercalary month
|
|
1977
|
+
return 30;
|
|
1978
|
+
else // intercalary month 5 days + possible leap day
|
|
1979
|
+
return $0e96efac8f672b88$var$getLeapDay(year) + 5;
|
|
1980
|
+
}
|
|
1981
|
+
class $0e96efac8f672b88$export$26ba6eab5e20cd7d {
|
|
1982
|
+
fromJulianDay(jd) {
|
|
1983
|
+
let date = $0e96efac8f672b88$var$julianDayToCE(this, $0e96efac8f672b88$var$ETHIOPIC_EPOCH, jd);
|
|
1984
|
+
if (date.year > 0) date.era = 'AM';
|
|
1985
|
+
else {
|
|
1986
|
+
date.era = 'AA';
|
|
1987
|
+
date.year += $0e96efac8f672b88$var$AMETE_MIHRET_DELTA;
|
|
1988
|
+
}
|
|
1989
|
+
return date;
|
|
1990
|
+
}
|
|
1991
|
+
toJulianDay(date) {
|
|
1992
|
+
let year = date.year;
|
|
1993
|
+
if (date.era === 'AA') year -= $0e96efac8f672b88$var$AMETE_MIHRET_DELTA;
|
|
1994
|
+
return $0e96efac8f672b88$var$ceToJulianDay($0e96efac8f672b88$var$ETHIOPIC_EPOCH, year, date.month, date.day);
|
|
1995
|
+
}
|
|
1996
|
+
getDaysInMonth(date) {
|
|
1997
|
+
let year = date.year;
|
|
1998
|
+
if (date.era === 'AA') year -= $0e96efac8f672b88$var$AMETE_MIHRET_DELTA;
|
|
1999
|
+
return $0e96efac8f672b88$var$getDaysInMonth(year, date.month);
|
|
2000
|
+
}
|
|
2001
|
+
getMonthsInYear() {
|
|
2002
|
+
return 13;
|
|
2003
|
+
}
|
|
2004
|
+
getDaysInYear(date) {
|
|
2005
|
+
return 365 + $0e96efac8f672b88$var$getLeapDay(date.year);
|
|
2006
|
+
}
|
|
2007
|
+
getYearsInEra() {
|
|
2008
|
+
return 9999;
|
|
2009
|
+
}
|
|
2010
|
+
getEras() {
|
|
2011
|
+
return [
|
|
2012
|
+
'AA',
|
|
2013
|
+
'AM'
|
|
2014
|
+
];
|
|
2015
|
+
}
|
|
2016
|
+
constructor(){
|
|
2017
|
+
this.identifier = 'ethiopic';
|
|
2018
|
+
}
|
|
2019
|
+
}
|
|
2020
|
+
class $0e96efac8f672b88$export$d72e0c37005a4914 extends $0e96efac8f672b88$export$26ba6eab5e20cd7d {
|
|
2021
|
+
fromJulianDay(jd) {
|
|
2022
|
+
let date = $0e96efac8f672b88$var$julianDayToCE(this, $0e96efac8f672b88$var$ETHIOPIC_EPOCH, jd);
|
|
2023
|
+
date.era = 'AA';
|
|
2024
|
+
date.year += $0e96efac8f672b88$var$AMETE_MIHRET_DELTA;
|
|
2025
|
+
return date;
|
|
2026
|
+
}
|
|
2027
|
+
getEras() {
|
|
2028
|
+
return [
|
|
2029
|
+
'AA'
|
|
2030
|
+
];
|
|
2031
|
+
}
|
|
2032
|
+
constructor(...args){
|
|
2033
|
+
super(...args);
|
|
2034
|
+
this.identifier // also known as 'ethiopic-amete-alem' in ICU
|
|
2035
|
+
= 'ethioaa';
|
|
2036
|
+
}
|
|
2037
|
+
}
|
|
2038
|
+
class $0e96efac8f672b88$export$fe6243cbe1a4b7c1 extends $0e96efac8f672b88$export$26ba6eab5e20cd7d {
|
|
2039
|
+
fromJulianDay(jd) {
|
|
2040
|
+
let date = $0e96efac8f672b88$var$julianDayToCE(this, $0e96efac8f672b88$var$COPTIC_EPOCH, jd);
|
|
2041
|
+
if (date.year <= 0) {
|
|
2042
|
+
date.era = 'BCE';
|
|
2043
|
+
date.year = 1 - date.year;
|
|
2044
|
+
} else date.era = 'CE';
|
|
2045
|
+
return date;
|
|
2046
|
+
}
|
|
2047
|
+
toJulianDay(date) {
|
|
2048
|
+
let year = date.year;
|
|
2049
|
+
if (date.era === 'BCE') year = 1 - year;
|
|
2050
|
+
return $0e96efac8f672b88$var$ceToJulianDay($0e96efac8f672b88$var$COPTIC_EPOCH, year, date.month, date.day);
|
|
2051
|
+
}
|
|
2052
|
+
getDaysInMonth(date) {
|
|
2053
|
+
let year = date.year;
|
|
2054
|
+
if (date.era === 'BCE') year = 1 - year;
|
|
2055
|
+
return $0e96efac8f672b88$var$getDaysInMonth(year, date.month);
|
|
2056
|
+
}
|
|
2057
|
+
getYearsToAdd(date, years) {
|
|
2058
|
+
return date.era === 'BCE' ? -years : years;
|
|
2059
|
+
}
|
|
2060
|
+
getEras() {
|
|
2061
|
+
return [
|
|
2062
|
+
'BCE',
|
|
2063
|
+
'CE'
|
|
2064
|
+
];
|
|
2065
|
+
}
|
|
2066
|
+
constructor(...args){
|
|
2067
|
+
super(...args);
|
|
2068
|
+
this.identifier = 'coptic';
|
|
2069
|
+
}
|
|
2070
|
+
}
|
|
2624
2071
|
|
|
2625
|
-
case 'hebrew':
|
|
2626
|
-
return new HebrewCalendar();
|
|
2627
2072
|
|
|
2628
|
-
case 'indian':
|
|
2629
|
-
return new IndianCalendar();
|
|
2630
2073
|
|
|
2631
|
-
case 'islamic-civil':
|
|
2632
|
-
return new IslamicCivilCalendar();
|
|
2633
2074
|
|
|
2634
|
-
case 'islamic-tbla':
|
|
2635
|
-
return new IslamicTabularCalendar();
|
|
2636
2075
|
|
|
2637
|
-
case 'islamic-umalqura':
|
|
2638
|
-
return new IslamicUmalquraCalendar();
|
|
2639
2076
|
|
|
2640
|
-
case 'japanese':
|
|
2641
|
-
return new JapaneseCalendar();
|
|
2642
2077
|
|
|
2643
|
-
case 'persian':
|
|
2644
|
-
return new PersianCalendar();
|
|
2645
2078
|
|
|
2646
|
-
case 'roc':
|
|
2647
|
-
return new TaiwanCalendar();
|
|
2648
2079
|
|
|
2649
|
-
case 'gregory':
|
|
2650
|
-
default:
|
|
2651
|
-
return new GregorianCalendar();
|
|
2652
|
-
}
|
|
2653
|
-
}
|
|
2654
2080
|
|
|
2655
|
-
exports.createCalendar = createCalendar;
|
|
2656
|
-
let $ecb868e9bf656e44b130863ca06$var$formatterCache = new Map();
|
|
2657
2081
|
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2082
|
+
function $ca230d05ece9bb5e$export$dd0bbc9b26defe37(name) {
|
|
2083
|
+
switch(name){
|
|
2084
|
+
case 'buddhist':
|
|
2085
|
+
return new $b20daff49d96eb86$export$42d20a78301dee44();
|
|
2086
|
+
case 'ethiopic':
|
|
2087
|
+
return new $0e96efac8f672b88$export$26ba6eab5e20cd7d();
|
|
2088
|
+
case 'ethioaa':
|
|
2089
|
+
return new $0e96efac8f672b88$export$d72e0c37005a4914();
|
|
2090
|
+
case 'coptic':
|
|
2091
|
+
return new $0e96efac8f672b88$export$fe6243cbe1a4b7c1();
|
|
2092
|
+
case 'hebrew':
|
|
2093
|
+
return new $33f6c3bb549d8eee$export$ca405048b8fb5af();
|
|
2094
|
+
case 'indian':
|
|
2095
|
+
return new $8f8e08f6046dcac2$export$39f31c639fa15726();
|
|
2096
|
+
case 'islamic-civil':
|
|
2097
|
+
return new $8ba87b21dd897347$export$2066795aadd37bfc();
|
|
2098
|
+
case 'islamic-tbla':
|
|
2099
|
+
return new $8ba87b21dd897347$export$37f0887f2f9d22f7();
|
|
2100
|
+
case 'islamic-umalqura':
|
|
2101
|
+
return new $8ba87b21dd897347$export$5baab4758c231076();
|
|
2102
|
+
case 'japanese':
|
|
2103
|
+
return new $4c8188d4ddf4ec96$export$b746ab2b60cdffbf();
|
|
2104
|
+
case 'persian':
|
|
2105
|
+
return new $cae8dbfeeb52b26c$export$37fccdbfd14c5939();
|
|
2106
|
+
case 'roc':
|
|
2107
|
+
return new $0034fbb09326c982$export$65e01080afcb0799();
|
|
2108
|
+
case 'gregory':
|
|
2109
|
+
default:
|
|
2110
|
+
return new $5adb4cba079e6f7b$export$80ee6245ec4f29ec();
|
|
2662
2111
|
}
|
|
2112
|
+
}
|
|
2663
2113
|
|
|
2664
|
-
this.formatter = void 0;
|
|
2665
|
-
this.options = void 0;
|
|
2666
|
-
this.resolvedHourCycle = void 0;
|
|
2667
|
-
this.formatter = $ecb868e9bf656e44b130863ca06$var$getCachedDateFormatter(locale, options);
|
|
2668
|
-
this.options = options;
|
|
2669
|
-
}
|
|
2670
|
-
|
|
2671
|
-
format(value) {
|
|
2672
|
-
return this.formatter.format(value);
|
|
2673
|
-
}
|
|
2674
2114
|
|
|
2675
|
-
formatToParts(value) {
|
|
2676
|
-
return this.formatter.formatToParts(value);
|
|
2677
|
-
}
|
|
2678
2115
|
|
|
2679
|
-
formatRange(start, end) {
|
|
2680
|
-
// @ts-ignore
|
|
2681
|
-
if (typeof this.formatter.formatRange === 'function') {
|
|
2682
|
-
// @ts-ignore
|
|
2683
|
-
return this.formatter.formatRange(start, end);
|
|
2684
|
-
}
|
|
2685
2116
|
|
|
2686
|
-
|
|
2687
|
-
throw new RangeError('End date must be >= start date');
|
|
2688
|
-
} // Very basic fallback for old browsers.
|
|
2117
|
+
var $3fc518fa50fb6c0b$exports = {};
|
|
2689
2118
|
|
|
2690
2119
|
|
|
2691
|
-
return this.formatter.format(start) + " \u2013 " + this.formatter.format(end);
|
|
2692
|
-
}
|
|
2693
2120
|
|
|
2694
|
-
|
|
2695
|
-
// @ts-ignore
|
|
2696
|
-
if (typeof this.formatter.formatRangeToParts === 'function') {
|
|
2697
|
-
// @ts-ignore
|
|
2698
|
-
return this.formatter.formatRangeToParts(start, end);
|
|
2699
|
-
}
|
|
2700
|
-
|
|
2701
|
-
if (end < start) {
|
|
2702
|
-
throw new RangeError('End date must be >= start date');
|
|
2703
|
-
}
|
|
2704
|
-
|
|
2705
|
-
let startParts = this.formatter.formatToParts(start);
|
|
2706
|
-
let endParts = this.formatter.formatToParts(end);
|
|
2707
|
-
return [...startParts.map(p => _babelRuntimeHelpersExtends({}, p, {
|
|
2708
|
-
source: 'startRange'
|
|
2709
|
-
})), {
|
|
2710
|
-
type: 'literal',
|
|
2711
|
-
value: ' – ',
|
|
2712
|
-
source: 'shared'
|
|
2713
|
-
}, ...endParts.map(p => _babelRuntimeHelpersExtends({}, p, {
|
|
2714
|
-
source: 'endRange'
|
|
2715
|
-
}))];
|
|
2716
|
-
}
|
|
2717
|
-
|
|
2718
|
-
resolvedOptions() {
|
|
2719
|
-
let resolvedOptions = this.formatter.resolvedOptions();
|
|
2720
|
-
|
|
2721
|
-
if ($ecb868e9bf656e44b130863ca06$var$hasBuggyResolvedHourCycle()) {
|
|
2722
|
-
if (!this.resolvedHourCycle) {
|
|
2723
|
-
this.resolvedHourCycle = $ecb868e9bf656e44b130863ca06$var$getResolvedHourCycle(resolvedOptions.locale, this.options);
|
|
2724
|
-
}
|
|
2121
|
+
var $856533592ad26e29$exports = {};
|
|
2725
2122
|
|
|
2726
|
-
|
|
2727
|
-
|
|
2123
|
+
$parcel$export($856533592ad26e29$exports, "DateFormatter", () => $856533592ad26e29$export$ad991b66133851cf);
|
|
2124
|
+
/*
|
|
2125
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
2126
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
2127
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
2128
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
2129
|
+
*
|
|
2130
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
2131
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
2132
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
2133
|
+
* governing permissions and limitations under the License.
|
|
2134
|
+
*/ let $856533592ad26e29$var$formatterCache = new Map();
|
|
2135
|
+
class $856533592ad26e29$export$ad991b66133851cf {
|
|
2136
|
+
constructor(locale, options = {
|
|
2137
|
+
}){
|
|
2138
|
+
this.formatter = $856533592ad26e29$var$getCachedDateFormatter(locale, options);
|
|
2139
|
+
this.options = options;
|
|
2728
2140
|
}
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2141
|
+
format(value) {
|
|
2142
|
+
return this.formatter.format(value);
|
|
2143
|
+
}
|
|
2144
|
+
formatToParts(value) {
|
|
2145
|
+
return this.formatter.formatToParts(value);
|
|
2146
|
+
}
|
|
2147
|
+
formatRange(start, end) {
|
|
2148
|
+
// @ts-ignore
|
|
2149
|
+
if (typeof this.formatter.formatRange === 'function') // @ts-ignore
|
|
2150
|
+
return this.formatter.formatRange(start, end);
|
|
2151
|
+
if (end < start) throw new RangeError('End date must be >= start date');
|
|
2152
|
+
// Very basic fallback for old browsers.
|
|
2153
|
+
return `${this.formatter.format(start)} – ${this.formatter.format(end)}`;
|
|
2154
|
+
}
|
|
2155
|
+
formatRangeToParts(start, end) {
|
|
2156
|
+
// @ts-ignore
|
|
2157
|
+
if (typeof this.formatter.formatRangeToParts === 'function') // @ts-ignore
|
|
2158
|
+
return this.formatter.formatRangeToParts(start, end);
|
|
2159
|
+
if (end < start) throw new RangeError('End date must be >= start date');
|
|
2160
|
+
let startParts = this.formatter.formatToParts(start);
|
|
2161
|
+
let endParts = this.formatter.formatToParts(end);
|
|
2162
|
+
return [
|
|
2163
|
+
...startParts.map((p)=>({
|
|
2164
|
+
...p,
|
|
2165
|
+
source: 'startRange'
|
|
2166
|
+
})
|
|
2167
|
+
),
|
|
2168
|
+
{
|
|
2169
|
+
type: 'literal',
|
|
2170
|
+
value: ' – ',
|
|
2171
|
+
source: 'shared'
|
|
2172
|
+
},
|
|
2173
|
+
...endParts.map((p)=>({
|
|
2174
|
+
...p,
|
|
2175
|
+
source: 'endRange'
|
|
2176
|
+
})
|
|
2177
|
+
)
|
|
2178
|
+
];
|
|
2179
|
+
}
|
|
2180
|
+
resolvedOptions() {
|
|
2181
|
+
let resolvedOptions = this.formatter.resolvedOptions();
|
|
2182
|
+
if ($856533592ad26e29$var$hasBuggyResolvedHourCycle()) {
|
|
2183
|
+
if (!this.resolvedHourCycle) this.resolvedHourCycle = $856533592ad26e29$var$getResolvedHourCycle(resolvedOptions.locale, this.options);
|
|
2184
|
+
resolvedOptions.hourCycle = this.resolvedHourCycle;
|
|
2185
|
+
resolvedOptions.hour12 = this.resolvedHourCycle === 'h11' || this.resolvedHourCycle === 'h12';
|
|
2186
|
+
}
|
|
2187
|
+
return resolvedOptions;
|
|
2188
|
+
}
|
|
2189
|
+
}
|
|
2190
|
+
// There are multiple bugs involving the hour12 and hourCycle options in various browser engines.
|
|
2734
2191
|
// - Chrome [1] (and the ECMA 402 spec [2]) resolve hour12: false in English and other locales to h24 (24:00 - 23:59)
|
|
2735
2192
|
// rather than h23 (00:00 - 23:59). Same can happen with hour12: true in French, which Chrome resolves to h11 (00:00 - 11:59)
|
|
2736
2193
|
// rather than h12 (12:00 - 11:59).
|
|
@@ -2740,102 +2197,78 @@ class DateFormatter {
|
|
|
2740
2197
|
// [2] https://github.com/tc39/ecma402/issues/402
|
|
2741
2198
|
// [3] https://bugs.webkit.org/show_bug.cgi?id=229313
|
|
2742
2199
|
// https://github.com/unicode-org/cldr/blob/018b55eff7ceb389c7e3fc44e2f657eae3b10b38/common/supplemental/supplementalData.xml#L4774-L4802
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
},
|
|
2751
|
-
false: {// All locales use h23 for 24 hour time. None use h24.
|
|
2752
|
-
}
|
|
2200
|
+
const $856533592ad26e29$var$hour12Preferences = {
|
|
2201
|
+
true: {
|
|
2202
|
+
// Only Japanese uses the h11 style for 12 hour time. All others use h12.
|
|
2203
|
+
ja: 'h11'
|
|
2204
|
+
},
|
|
2205
|
+
false: {
|
|
2206
|
+
}
|
|
2753
2207
|
};
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
}
|
|
2780
|
-
|
|
2781
|
-
let $ecb868e9bf656e44b130863ca06$var$_hasBuggyHour12Behavior = null;
|
|
2782
|
-
|
|
2783
|
-
function $ecb868e9bf656e44b130863ca06$var$hasBuggyHour12Behavior() {
|
|
2784
|
-
if ($ecb868e9bf656e44b130863ca06$var$_hasBuggyHour12Behavior == null) {
|
|
2785
|
-
$ecb868e9bf656e44b130863ca06$var$_hasBuggyHour12Behavior = new Intl.DateTimeFormat('en-US', {
|
|
2786
|
-
hour: 'numeric',
|
|
2787
|
-
hour12: false
|
|
2208
|
+
function $856533592ad26e29$var$getCachedDateFormatter(locale, options = {
|
|
2209
|
+
}) {
|
|
2210
|
+
// Work around buggy hour12 behavior in Chrome / ECMA 402 spec by using hourCycle instead.
|
|
2211
|
+
// Only apply the workaround if the issue is detected, because the hourCycle option is buggy in Safari.
|
|
2212
|
+
if (typeof options.hour12 === 'boolean' && $856533592ad26e29$var$hasBuggyHour12Behavior()) {
|
|
2213
|
+
options = {
|
|
2214
|
+
...options
|
|
2215
|
+
};
|
|
2216
|
+
let pref = $856533592ad26e29$var$hour12Preferences[String(options.hour12)][locale.split('-')[0]];
|
|
2217
|
+
let defaultHourCycle = options.hour12 ? 'h12' : 'h23';
|
|
2218
|
+
options.hourCycle = pref ?? defaultHourCycle;
|
|
2219
|
+
delete options.hour12;
|
|
2220
|
+
}
|
|
2221
|
+
let cacheKey = locale + (options ? Object.entries(options).sort((a, b)=>a[0] < b[0] ? -1 : 1
|
|
2222
|
+
).join() : '');
|
|
2223
|
+
if ($856533592ad26e29$var$formatterCache.has(cacheKey)) return $856533592ad26e29$var$formatterCache.get(cacheKey);
|
|
2224
|
+
let numberFormatter = new Intl.DateTimeFormat(locale, options);
|
|
2225
|
+
$856533592ad26e29$var$formatterCache.set(cacheKey, numberFormatter);
|
|
2226
|
+
return numberFormatter;
|
|
2227
|
+
}
|
|
2228
|
+
let $856533592ad26e29$var$_hasBuggyHour12Behavior = null;
|
|
2229
|
+
function $856533592ad26e29$var$hasBuggyHour12Behavior() {
|
|
2230
|
+
if ($856533592ad26e29$var$_hasBuggyHour12Behavior == null) $856533592ad26e29$var$_hasBuggyHour12Behavior = new Intl.DateTimeFormat('en-US', {
|
|
2231
|
+
hour: 'numeric',
|
|
2232
|
+
hour12: false
|
|
2788
2233
|
}).format(new Date(2020, 2, 3, 0)) === '24';
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
return $ecb868e9bf656e44b130863ca06$var$_hasBuggyHour12Behavior;
|
|
2234
|
+
return $856533592ad26e29$var$_hasBuggyHour12Behavior;
|
|
2792
2235
|
}
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
$ecb868e9bf656e44b130863ca06$var$_hasBuggyResolvedHourCycle = new Intl.DateTimeFormat('fr', {
|
|
2799
|
-
hour: 'numeric',
|
|
2800
|
-
hour12: false
|
|
2236
|
+
let $856533592ad26e29$var$_hasBuggyResolvedHourCycle = null;
|
|
2237
|
+
function $856533592ad26e29$var$hasBuggyResolvedHourCycle() {
|
|
2238
|
+
if ($856533592ad26e29$var$_hasBuggyResolvedHourCycle == null) $856533592ad26e29$var$_hasBuggyResolvedHourCycle = new Intl.DateTimeFormat('fr', {
|
|
2239
|
+
hour: 'numeric',
|
|
2240
|
+
hour12: false
|
|
2801
2241
|
}).resolvedOptions().hourCycle === 'h12';
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2242
|
+
return $856533592ad26e29$var$_hasBuggyResolvedHourCycle;
|
|
2243
|
+
}
|
|
2244
|
+
function $856533592ad26e29$var$getResolvedHourCycle(locale, options) {
|
|
2245
|
+
if (!options.timeStyle && !options.hour) return undefined;
|
|
2246
|
+
// Work around buggy results in resolved hourCycle and hour12 options in WebKit.
|
|
2247
|
+
// Format the minimum possible hour and maximum possible hour in a day and parse the results.
|
|
2248
|
+
locale = locale.replace(/(-u-)?-nu-[a-zA-Z0-9]+/, '');
|
|
2249
|
+
locale += (locale.includes('-u-') ? '' : '-u') + '-nu-latn';
|
|
2250
|
+
let formatter = $856533592ad26e29$var$getCachedDateFormatter(locale, {
|
|
2251
|
+
...options,
|
|
2252
|
+
timeZone: undefined // use local timezone
|
|
2253
|
+
});
|
|
2254
|
+
let min = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 0)).find((p)=>p.type === 'hour'
|
|
2255
|
+
).value, 10);
|
|
2256
|
+
let max = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 23)).find((p)=>p.type === 'hour'
|
|
2257
|
+
).value, 10);
|
|
2258
|
+
if (min === 0 && max === 23) return 'h23';
|
|
2259
|
+
if (min === 24 && max === 23) return 'h24';
|
|
2260
|
+
if (min === 0 && max === 11) return 'h11';
|
|
2261
|
+
if (min === 12 && max === 11) return 'h12';
|
|
2262
|
+
throw new Error('Unexpected hour cycle result');
|
|
2805
2263
|
}
|
|
2806
2264
|
|
|
2807
|
-
function $ecb868e9bf656e44b130863ca06$var$getResolvedHourCycle(locale, options) {
|
|
2808
|
-
if (!options.timeStyle && !options.hour) {
|
|
2809
|
-
return undefined;
|
|
2810
|
-
} // Work around buggy results in resolved hourCycle and hour12 options in WebKit.
|
|
2811
|
-
// Format the minimum possible hour and maximum possible hour in a day and parse the results.
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
locale = locale.replace(/(-u-)?-nu-[a-zA-Z0-9]+/, '');
|
|
2815
|
-
locale += (locale.includes('-u-') ? '' : '-u') + '-nu-latn';
|
|
2816
|
-
let formatter = $ecb868e9bf656e44b130863ca06$var$getCachedDateFormatter(locale, _babelRuntimeHelpersExtends({}, options, {
|
|
2817
|
-
timeZone: undefined // use local timezone
|
|
2818
2265
|
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2266
|
+
$parcel$exportWildcard(module.exports, $9bb5411e4ba634f9$exports);
|
|
2267
|
+
$parcel$exportWildcard(module.exports, $1842b789961e6c21$exports);
|
|
2268
|
+
$parcel$exportWildcard(module.exports, $77587dc5ead8743c$exports);
|
|
2269
|
+
$parcel$exportWildcard(module.exports, $3fc518fa50fb6c0b$exports);
|
|
2270
|
+
$parcel$exportWildcard(module.exports, $6cc7196afcc354cc$exports);
|
|
2271
|
+
$parcel$exportWildcard(module.exports, $856533592ad26e29$exports);
|
|
2822
2272
|
|
|
2823
|
-
if (min === 0 && max === 23) {
|
|
2824
|
-
return 'h23';
|
|
2825
|
-
}
|
|
2826
2273
|
|
|
2827
|
-
if (min === 24 && max === 23) {
|
|
2828
|
-
return 'h24';
|
|
2829
|
-
}
|
|
2830
|
-
|
|
2831
|
-
if (min === 0 && max === 11) {
|
|
2832
|
-
return 'h11';
|
|
2833
|
-
}
|
|
2834
|
-
|
|
2835
|
-
if (min === 12 && max === 11) {
|
|
2836
|
-
return 'h12';
|
|
2837
|
-
}
|
|
2838
|
-
|
|
2839
|
-
throw new Error('Unexpected hour cycle result');
|
|
2840
|
-
}
|
|
2841
2274
|
//# sourceMappingURL=main.js.map
|