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