@byuckchon-frontend/utils 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/index.mjs +3123 -106
- package/dist/index.umd.js +1 -1
- package/dist/src/DateUtils/index.d.ts +14 -0
- package/dist/src/filterParams/index.d.ts +55 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/userAgent/index.d.ts +23 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,30 +1,122 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return
|
|
15
|
-
|
|
16
|
-
return
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
1
|
+
const ve = (r, e = {}) => {
|
|
2
|
+
const {
|
|
3
|
+
removeUndefined: t = !0,
|
|
4
|
+
removeNull: n = !0,
|
|
5
|
+
removeEmptyString: a = !0,
|
|
6
|
+
removeEmptyArray: s = !0,
|
|
7
|
+
removeEmptyObject: o = !0,
|
|
8
|
+
normalizeNumbers: i = !1,
|
|
9
|
+
normalizeBooleans: c = !1,
|
|
10
|
+
normalizeNested: l = !1
|
|
11
|
+
} = e, h = (u) => {
|
|
12
|
+
switch (!0) {
|
|
13
|
+
case (t && u === void 0):
|
|
14
|
+
return !0;
|
|
15
|
+
case (n && u === null):
|
|
16
|
+
return !0;
|
|
17
|
+
case (a && u === ""):
|
|
18
|
+
return !0;
|
|
19
|
+
case (s && Array.isArray(u) && u.length === 0):
|
|
20
|
+
return !0;
|
|
21
|
+
case (o && typeof u == "object" && u !== null && !Array.isArray(u) && Object.keys(u).length === 0):
|
|
22
|
+
return !0;
|
|
23
|
+
default:
|
|
24
|
+
return !1;
|
|
25
|
+
}
|
|
26
|
+
}, m = (u) => {
|
|
27
|
+
if (typeof u == "object" && u !== null) {
|
|
28
|
+
if (Array.isArray(u))
|
|
29
|
+
return l ? u.map((x) => m(x)).filter((x) => !h(x)) : u;
|
|
30
|
+
if (typeof u == "object")
|
|
31
|
+
return l ? ve(u, e) : u;
|
|
32
|
+
}
|
|
33
|
+
if (typeof u == "string") {
|
|
34
|
+
const x = u.trim();
|
|
35
|
+
if (c) {
|
|
36
|
+
const T = x.toLowerCase();
|
|
37
|
+
if (T === "true") return !0;
|
|
38
|
+
if (T === "false") return !1;
|
|
39
|
+
}
|
|
40
|
+
return x;
|
|
41
|
+
}
|
|
42
|
+
return i && typeof u == "number" ? String(u) : u;
|
|
43
|
+
};
|
|
44
|
+
return Object.fromEntries(
|
|
45
|
+
Object.entries(r).map(([u, x]) => [u, m(x)]).filter(([, u]) => !h(u))
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
function v() {
|
|
49
|
+
return typeof window > "u" || "Deno" in globalThis;
|
|
50
|
+
}
|
|
51
|
+
function _e() {
|
|
52
|
+
return !v();
|
|
53
|
+
}
|
|
54
|
+
function ie() {
|
|
55
|
+
return v() ? !1 : /ipad|iphone/i.test(navigator.userAgent);
|
|
56
|
+
}
|
|
57
|
+
function ce() {
|
|
58
|
+
return v() ? !1 : /Macintosh|MacIntel|MacPPC|Mac68K/.test(navigator.platform);
|
|
59
|
+
}
|
|
60
|
+
function ue() {
|
|
61
|
+
return v() ? !1 : /Android/i.test(navigator.userAgent);
|
|
62
|
+
}
|
|
63
|
+
function Ee() {
|
|
64
|
+
return v() ? !1 : /MSIE|Trident/i.test(navigator.userAgent);
|
|
65
|
+
}
|
|
66
|
+
function de() {
|
|
67
|
+
return v() ? !1 : /KAKAOTALK/i.test(navigator.userAgent);
|
|
68
|
+
}
|
|
69
|
+
function j() {
|
|
70
|
+
return v() ? !1 : ie() ? "ios" : ue() ? "android" : "web";
|
|
71
|
+
}
|
|
72
|
+
function We() {
|
|
73
|
+
const r = j();
|
|
74
|
+
return r === "ios" || r === "android";
|
|
75
|
+
}
|
|
76
|
+
function $e() {
|
|
77
|
+
if (v()) return "server";
|
|
78
|
+
if (de()) return "kakao";
|
|
79
|
+
const r = j();
|
|
80
|
+
return r === "ios" || r === "android" ? r : ce() ? "macos" : "web";
|
|
81
|
+
}
|
|
82
|
+
const pr = {
|
|
83
|
+
isServer: v,
|
|
84
|
+
isClient: _e,
|
|
85
|
+
isIOS: ie,
|
|
86
|
+
isAndroid: ue,
|
|
87
|
+
isMacOS: ce,
|
|
88
|
+
isIE: Ee,
|
|
89
|
+
isKakaoWebView: de,
|
|
90
|
+
isMobileWeb: We,
|
|
91
|
+
getOSByUserAgent: j,
|
|
92
|
+
getPlatform: $e
|
|
93
|
+
}, xr = () => ({
|
|
94
|
+
formatPhoneNumber: (o) => {
|
|
95
|
+
const i = (o ?? "").replace(/\D/g, "");
|
|
96
|
+
if (/^1[568]\d{7}$/.test(i))
|
|
97
|
+
return i.replace(/^(\d{4})(\d{4})$/, "$1-$2");
|
|
98
|
+
if (i.startsWith("02")) {
|
|
99
|
+
if (i.length === 9)
|
|
100
|
+
return i.replace(/^(\d{2})(\d{3})(\d{4})$/, "$1-$2-$3");
|
|
101
|
+
if (i.length === 10)
|
|
102
|
+
return i.replace(/^(\d{2})(\d{4})(\d{4})$/, "$1-$2-$3");
|
|
103
|
+
}
|
|
104
|
+
if (/^0\d+/.test(i)) {
|
|
105
|
+
if (i.length === 10)
|
|
106
|
+
return i.replace(/^(\d{3})(\d{3})(\d{4})$/, "$1-$2-$3");
|
|
107
|
+
if (i.length === 11)
|
|
108
|
+
return i.replace(/^(\d{3})(\d{4})(\d{4})$/, "$1-$2-$3");
|
|
109
|
+
}
|
|
110
|
+
return o;
|
|
111
|
+
},
|
|
112
|
+
formatBizNumber: (o) => {
|
|
113
|
+
const i = (o ?? "").replace(/\D/g, "");
|
|
114
|
+
return i.length === 10 ? i.replace(/^(\d{3})(\d{2})(\d{5})$/, "$1-$2-$3") : i.length === 13 ? i.replace(/^(\d{6})(\d{7})$/, "$1-$2") : String(o ?? "");
|
|
115
|
+
},
|
|
116
|
+
formatDate: (o) => {
|
|
117
|
+
if (!(o instanceof Date) || isNaN(o.getTime())) return "";
|
|
118
|
+
const i = o.getHours(), c = o.getMinutes(), l = i < 12 ? "오전" : "오후", h = i % 12 === 0 ? 12 : i % 12;
|
|
119
|
+
return `${l} ${h}시 ${c}분`;
|
|
28
120
|
},
|
|
29
121
|
Masker: {
|
|
30
122
|
/**
|
|
@@ -40,16 +132,16 @@ const C = () => ({
|
|
|
40
132
|
* Masker.maskName("홍길"); // "홍*"
|
|
41
133
|
* Masker.maskName("홍길동"); // "홍*동"
|
|
42
134
|
*/
|
|
43
|
-
maskName: (
|
|
44
|
-
const
|
|
45
|
-
if (
|
|
46
|
-
if (
|
|
47
|
-
if (
|
|
48
|
-
const [
|
|
49
|
-
return `${
|
|
135
|
+
maskName: (o) => {
|
|
136
|
+
const i = (o ?? "").trim(), c = [...i].length;
|
|
137
|
+
if (c <= 0) return "";
|
|
138
|
+
if (c === 1) return "*";
|
|
139
|
+
if (c === 2) {
|
|
140
|
+
const [x] = [...i];
|
|
141
|
+
return `${x}*`;
|
|
50
142
|
}
|
|
51
|
-
const
|
|
52
|
-
return `${
|
|
143
|
+
const l = [...i], h = l[0], m = l[c - 1], u = "*".repeat(c - 2);
|
|
144
|
+
return `${h}${u}${m}`;
|
|
53
145
|
},
|
|
54
146
|
/**
|
|
55
147
|
* 전화번호 마스킹
|
|
@@ -62,94 +154,3019 @@ const C = () => ({
|
|
|
62
154
|
* Masker.maskPhoneNumber("010-1234-5678"); // "010-****-5678"
|
|
63
155
|
* Masker.maskPhoneNumber("0212345678"); // "021****678" (하이픈 미포함 입력)
|
|
64
156
|
*/
|
|
65
|
-
maskPhoneNumber: (
|
|
66
|
-
if (
|
|
67
|
-
const
|
|
68
|
-
if (
|
|
69
|
-
const [
|
|
70
|
-
return `${
|
|
71
|
-
|
|
72
|
-
)}-${
|
|
157
|
+
maskPhoneNumber: (o) => {
|
|
158
|
+
if (o.includes("-")) {
|
|
159
|
+
const m = o.split("-");
|
|
160
|
+
if (m.length === 3) {
|
|
161
|
+
const [u, x, T] = m;
|
|
162
|
+
return `${u}-${"*".repeat(
|
|
163
|
+
x.replace(/\D/g, "").length || 4
|
|
164
|
+
)}-${T}`;
|
|
73
165
|
}
|
|
74
|
-
if (
|
|
75
|
-
const [
|
|
76
|
-
return `${
|
|
166
|
+
if (m.length === 2) {
|
|
167
|
+
const [u, x] = m, T = x.replace(/\D/g, ""), W = T.slice(-4), f = Math.max(1, T.length - W.length);
|
|
168
|
+
return `${u}-${"*".repeat(f)}${W}`;
|
|
77
169
|
}
|
|
78
|
-
return
|
|
170
|
+
return o;
|
|
79
171
|
}
|
|
80
|
-
const
|
|
81
|
-
if (
|
|
82
|
-
const
|
|
83
|
-
return `${
|
|
172
|
+
const i = o.replace(/\D/g, "");
|
|
173
|
+
if (i.length < 8) return o;
|
|
174
|
+
const c = i.slice(0, 3), l = i.slice(-4), h = Math.max(1, i.length - (c.length + l.length));
|
|
175
|
+
return `${c}${"*".repeat(h)}${l}`;
|
|
84
176
|
}
|
|
85
177
|
},
|
|
86
|
-
commanizeData: (
|
|
87
|
-
const
|
|
88
|
-
if (!
|
|
89
|
-
const
|
|
90
|
-
return
|
|
178
|
+
commanizeData: (o) => {
|
|
179
|
+
const i = String(o ?? "").trim();
|
|
180
|
+
if (!i) return "";
|
|
181
|
+
const c = i.replace(/,/g, ""), l = c.startsWith("-") ? "-" : "", h = c.replace(/^-/, ""), [m, u] = h.split("."), x = m.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
182
|
+
return l + x + (u !== void 0 ? `.${u}` : "");
|
|
91
183
|
},
|
|
92
|
-
decommanizeData: (
|
|
93
|
-
}),
|
|
94
|
-
function
|
|
95
|
-
return
|
|
184
|
+
decommanizeData: (o) => o.replace(/,/g, "")
|
|
185
|
+
}), Ne = /^[A-Za-z0-9]([A-Za-z0-9_.+-]*[A-Za-z0-9])?@[A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])?\.[A-Za-z]{2,}$/, Fe = /^010(\d{4})(\d{4})$/, He = /^(070|02|031|032|033|034|035|036|037|038|039|041|042|043|051|052|053|054|055|061|062|063|064|070|071|072)[0-9]{3,4}[0-9]{4}$/, qe = /([0-9]{2}(0[1-9]|1[0-2])(0[1-9]|[1,2][0-9]|3[0,1]))/, Ie = /^(19[0-9][0-9]|20\d{2})(0[0-9]|1[0-2])(0[1-9]|[1-2][0-9]|3[0-1])$/, Le = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*()_+~`\-={}[\]:;"'<>,.?/\\]).{10,}$/, Ae = /^d{2}([0]\d|[1][0-2])([0][1-9]|[1-2]\d|[3][0-1])[-]*[1-4]\d{6}$/, Ce = /^(?:[0-9]{2}(?:0[1-9]|1[0-2])(?:0[1-9]|[1,2][0-9]|3[0,1]))-[1-8][0-9]{6}$/, Re = /^https?:\/\/(?:[-\w.])+(?:\.[a-zA-Z]{2,})+(?::\d+)?(?:\/[^\s]*)?$/i, Qe = /\.(jpg|jpeg|png|gif|pdf|doc|docx|xls|xlsx|ppt|pptx|txt|zip|rar)$/i;
|
|
186
|
+
function Be(r) {
|
|
187
|
+
return Ne.test(r);
|
|
96
188
|
}
|
|
97
|
-
function
|
|
98
|
-
return
|
|
189
|
+
function ze(r) {
|
|
190
|
+
return Fe.test(r);
|
|
99
191
|
}
|
|
100
|
-
function
|
|
101
|
-
return
|
|
192
|
+
function Xe(r) {
|
|
193
|
+
return He.test(r);
|
|
102
194
|
}
|
|
103
|
-
function
|
|
104
|
-
return
|
|
195
|
+
function je(r) {
|
|
196
|
+
return qe.test(r);
|
|
105
197
|
}
|
|
106
|
-
function
|
|
107
|
-
return
|
|
198
|
+
function Ge(r) {
|
|
199
|
+
return Ie.test(r);
|
|
108
200
|
}
|
|
109
|
-
function
|
|
110
|
-
return
|
|
201
|
+
function Ve(r) {
|
|
202
|
+
return Le.test(r);
|
|
111
203
|
}
|
|
112
|
-
function
|
|
113
|
-
return
|
|
204
|
+
function Ze(r) {
|
|
205
|
+
return Ae.test(r);
|
|
114
206
|
}
|
|
115
|
-
function
|
|
116
|
-
return
|
|
207
|
+
function Ke(r) {
|
|
208
|
+
return Ce.test(r);
|
|
117
209
|
}
|
|
118
|
-
function
|
|
119
|
-
const
|
|
120
|
-
if (
|
|
121
|
-
if (
|
|
210
|
+
function Je(r) {
|
|
211
|
+
const e = r.replace(/-/gi, "").split("").map((t) => parseInt(t, 10));
|
|
212
|
+
if (e.length === 10) {
|
|
213
|
+
if (e.every((s) => s === 0))
|
|
122
214
|
return !1;
|
|
123
|
-
const
|
|
124
|
-
let
|
|
125
|
-
for (let
|
|
126
|
-
|
|
127
|
-
const
|
|
128
|
-
return
|
|
215
|
+
const t = [1, 3, 7, 1, 3, 7, 1, 3, 5];
|
|
216
|
+
let n = 0;
|
|
217
|
+
for (let s = 0; s < 9; s++)
|
|
218
|
+
n += t[s] * e[s];
|
|
219
|
+
const a = (10 - n % 10) % 10;
|
|
220
|
+
return e[9] === a;
|
|
129
221
|
}
|
|
130
222
|
return !1;
|
|
131
223
|
}
|
|
132
|
-
function
|
|
133
|
-
return
|
|
134
|
-
}
|
|
135
|
-
function
|
|
136
|
-
const
|
|
137
|
-
return !(!
|
|
138
|
-
}
|
|
139
|
-
const
|
|
140
|
-
email:
|
|
141
|
-
phone:
|
|
142
|
-
homePhone:
|
|
143
|
-
birth6:
|
|
144
|
-
birth8:
|
|
145
|
-
password:
|
|
146
|
-
juminAfter2020:
|
|
147
|
-
juminBefore2020:
|
|
148
|
-
corporateRegiNumber:
|
|
149
|
-
url:
|
|
150
|
-
file:
|
|
224
|
+
function Ue(r) {
|
|
225
|
+
return Re.test(r);
|
|
226
|
+
}
|
|
227
|
+
function Se(r, e = 10) {
|
|
228
|
+
const t = typeof r == "string" ? r : r.name;
|
|
229
|
+
return !(!Qe.test(t) || r instanceof File && r.size / 1048576 > e);
|
|
230
|
+
}
|
|
231
|
+
const Mr = {
|
|
232
|
+
email: Be,
|
|
233
|
+
phone: ze,
|
|
234
|
+
homePhone: Xe,
|
|
235
|
+
birth6: je,
|
|
236
|
+
birth8: Ge,
|
|
237
|
+
password: Ve,
|
|
238
|
+
juminAfter2020: Ke,
|
|
239
|
+
juminBefore2020: Ze,
|
|
240
|
+
corporateRegiNumber: Je,
|
|
241
|
+
url: Ue,
|
|
242
|
+
file: Se
|
|
243
|
+
}, le = 6048e5, et = 864e5, fe = 6e4, he = 36e5, tt = 1e3, ee = Symbol.for("constructDateFrom");
|
|
244
|
+
function P(r, e) {
|
|
245
|
+
return typeof r == "function" ? r(e) : r && typeof r == "object" && ee in r ? r[ee](e) : r instanceof Date ? new r.constructor(e) : new Date(e);
|
|
246
|
+
}
|
|
247
|
+
function w(r, e) {
|
|
248
|
+
return P(e || r, r);
|
|
249
|
+
}
|
|
250
|
+
function me(r, e, t) {
|
|
251
|
+
const n = w(r, t?.in);
|
|
252
|
+
return isNaN(e) ? P(t?.in || r, NaN) : (e && n.setDate(n.getDate() + e), n);
|
|
253
|
+
}
|
|
254
|
+
let nt = {};
|
|
255
|
+
function q() {
|
|
256
|
+
return nt;
|
|
257
|
+
}
|
|
258
|
+
function E(r, e) {
|
|
259
|
+
const t = q(), n = e?.weekStartsOn ?? e?.locale?.options?.weekStartsOn ?? t.weekStartsOn ?? t.locale?.options?.weekStartsOn ?? 0, a = w(r, e?.in), s = a.getDay(), o = (s < n ? 7 : 0) + s - n;
|
|
260
|
+
return a.setDate(a.getDate() - o), a.setHours(0, 0, 0, 0), a;
|
|
261
|
+
}
|
|
262
|
+
function H(r, e) {
|
|
263
|
+
return E(r, { ...e, weekStartsOn: 1 });
|
|
264
|
+
}
|
|
265
|
+
function we(r, e) {
|
|
266
|
+
const t = w(r, e?.in), n = t.getFullYear(), a = P(t, 0);
|
|
267
|
+
a.setFullYear(n + 1, 0, 4), a.setHours(0, 0, 0, 0);
|
|
268
|
+
const s = H(a), o = P(t, 0);
|
|
269
|
+
o.setFullYear(n, 0, 4), o.setHours(0, 0, 0, 0);
|
|
270
|
+
const i = H(o);
|
|
271
|
+
return t.getTime() >= s.getTime() ? n + 1 : t.getTime() >= i.getTime() ? n : n - 1;
|
|
272
|
+
}
|
|
273
|
+
function C(r) {
|
|
274
|
+
const e = w(r), t = new Date(
|
|
275
|
+
Date.UTC(
|
|
276
|
+
e.getFullYear(),
|
|
277
|
+
e.getMonth(),
|
|
278
|
+
e.getDate(),
|
|
279
|
+
e.getHours(),
|
|
280
|
+
e.getMinutes(),
|
|
281
|
+
e.getSeconds(),
|
|
282
|
+
e.getMilliseconds()
|
|
283
|
+
)
|
|
284
|
+
);
|
|
285
|
+
return t.setUTCFullYear(e.getFullYear()), +r - +t;
|
|
286
|
+
}
|
|
287
|
+
function N(r, ...e) {
|
|
288
|
+
const t = P.bind(
|
|
289
|
+
null,
|
|
290
|
+
r || e.find((n) => typeof n == "object")
|
|
291
|
+
);
|
|
292
|
+
return e.map(t);
|
|
293
|
+
}
|
|
294
|
+
function te(r, e) {
|
|
295
|
+
const t = w(r, e?.in);
|
|
296
|
+
return t.setHours(0, 0, 0, 0), t;
|
|
297
|
+
}
|
|
298
|
+
function ge(r, e, t) {
|
|
299
|
+
const [n, a] = N(
|
|
300
|
+
t?.in,
|
|
301
|
+
r,
|
|
302
|
+
e
|
|
303
|
+
), s = te(n), o = te(a), i = +s - C(s), c = +o - C(o);
|
|
304
|
+
return Math.round((i - c) / et);
|
|
305
|
+
}
|
|
306
|
+
function rt(r, e) {
|
|
307
|
+
const t = we(r, e), n = P(r, 0);
|
|
308
|
+
return n.setFullYear(t, 0, 4), n.setHours(0, 0, 0, 0), H(n);
|
|
309
|
+
}
|
|
310
|
+
function A(r, e) {
|
|
311
|
+
const t = +w(r) - +w(e);
|
|
312
|
+
return t < 0 ? -1 : t > 0 ? 1 : t;
|
|
313
|
+
}
|
|
314
|
+
function at(r) {
|
|
315
|
+
return r instanceof Date || typeof r == "object" && Object.prototype.toString.call(r) === "[object Date]";
|
|
316
|
+
}
|
|
317
|
+
function st(r) {
|
|
318
|
+
return !(!at(r) && typeof r != "number" || isNaN(+w(r)));
|
|
319
|
+
}
|
|
320
|
+
function ot(r, e, t) {
|
|
321
|
+
const [n, a] = N(
|
|
322
|
+
t?.in,
|
|
323
|
+
r,
|
|
324
|
+
e
|
|
325
|
+
), s = n.getFullYear() - a.getFullYear(), o = n.getMonth() - a.getMonth();
|
|
326
|
+
return s * 12 + o;
|
|
327
|
+
}
|
|
328
|
+
function it(r, e, t) {
|
|
329
|
+
const [n, a] = N(
|
|
330
|
+
t?.in,
|
|
331
|
+
r,
|
|
332
|
+
e
|
|
333
|
+
);
|
|
334
|
+
return n.getFullYear() - a.getFullYear();
|
|
335
|
+
}
|
|
336
|
+
function ye(r, e, t) {
|
|
337
|
+
const [n, a] = N(
|
|
338
|
+
t?.in,
|
|
339
|
+
r,
|
|
340
|
+
e
|
|
341
|
+
), s = ne(n, a), o = Math.abs(
|
|
342
|
+
ge(n, a)
|
|
343
|
+
);
|
|
344
|
+
n.setDate(n.getDate() - s * o);
|
|
345
|
+
const i = +(ne(n, a) === -s), c = s * (o - i);
|
|
346
|
+
return c === 0 ? 0 : c;
|
|
347
|
+
}
|
|
348
|
+
function ne(r, e) {
|
|
349
|
+
const t = r.getFullYear() - e.getFullYear() || r.getMonth() - e.getMonth() || r.getDate() - e.getDate() || r.getHours() - e.getHours() || r.getMinutes() - e.getMinutes() || r.getSeconds() - e.getSeconds() || r.getMilliseconds() - e.getMilliseconds();
|
|
350
|
+
return t < 0 ? -1 : t > 0 ? 1 : t;
|
|
351
|
+
}
|
|
352
|
+
function G(r) {
|
|
353
|
+
return (e) => {
|
|
354
|
+
const n = (r ? Math[r] : Math.trunc)(e);
|
|
355
|
+
return n === 0 ? 0 : n;
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
function ct(r, e, t) {
|
|
359
|
+
const [n, a] = N(
|
|
360
|
+
t?.in,
|
|
361
|
+
r,
|
|
362
|
+
e
|
|
363
|
+
), s = (+n - +a) / he;
|
|
364
|
+
return G(t?.roundingMethod)(s);
|
|
365
|
+
}
|
|
366
|
+
function ut(r, e) {
|
|
367
|
+
return +w(r) - +w(e);
|
|
368
|
+
}
|
|
369
|
+
function dt(r, e, t) {
|
|
370
|
+
const n = ut(r, e) / fe;
|
|
371
|
+
return G(t?.roundingMethod)(n);
|
|
372
|
+
}
|
|
373
|
+
function lt(r, e) {
|
|
374
|
+
const t = w(r, e?.in);
|
|
375
|
+
return t.setHours(23, 59, 59, 999), t;
|
|
376
|
+
}
|
|
377
|
+
function ft(r, e) {
|
|
378
|
+
const t = w(r, e?.in), n = t.getMonth();
|
|
379
|
+
return t.setFullYear(t.getFullYear(), n + 1, 0), t.setHours(23, 59, 59, 999), t;
|
|
380
|
+
}
|
|
381
|
+
function ht(r, e) {
|
|
382
|
+
const t = w(r, e?.in);
|
|
383
|
+
return +lt(t, e) == +ft(t, e);
|
|
384
|
+
}
|
|
385
|
+
function mt(r, e, t) {
|
|
386
|
+
const [n, a, s] = N(
|
|
387
|
+
t?.in,
|
|
388
|
+
r,
|
|
389
|
+
r,
|
|
390
|
+
e
|
|
391
|
+
), o = A(a, s), i = Math.abs(
|
|
392
|
+
ot(a, s)
|
|
393
|
+
);
|
|
394
|
+
if (i < 1) return 0;
|
|
395
|
+
a.getMonth() === 1 && a.getDate() > 27 && a.setDate(30), a.setMonth(a.getMonth() - o * i);
|
|
396
|
+
let c = A(a, s) === -o;
|
|
397
|
+
ht(n) && i === 1 && A(n, s) === 1 && (c = !1);
|
|
398
|
+
const l = o * (i - +c);
|
|
399
|
+
return l === 0 ? 0 : l;
|
|
400
|
+
}
|
|
401
|
+
function wt(r, e, t) {
|
|
402
|
+
const n = ye(r, e, t) / 7;
|
|
403
|
+
return G(t?.roundingMethod)(n);
|
|
404
|
+
}
|
|
405
|
+
function gt(r, e, t) {
|
|
406
|
+
const [n, a] = N(
|
|
407
|
+
t?.in,
|
|
408
|
+
r,
|
|
409
|
+
e
|
|
410
|
+
), s = A(n, a), o = Math.abs(it(n, a));
|
|
411
|
+
n.setFullYear(1584), a.setFullYear(1584);
|
|
412
|
+
const i = A(n, a) === -s, c = s * (o - +i);
|
|
413
|
+
return c === 0 ? 0 : c;
|
|
414
|
+
}
|
|
415
|
+
function yt(r, e) {
|
|
416
|
+
const t = w(r, e?.in);
|
|
417
|
+
return t.setFullYear(t.getFullYear(), 0, 1), t.setHours(0, 0, 0, 0), t;
|
|
418
|
+
}
|
|
419
|
+
const bt = {
|
|
420
|
+
lessThanXSeconds: {
|
|
421
|
+
one: "less than a second",
|
|
422
|
+
other: "less than {{count}} seconds"
|
|
423
|
+
},
|
|
424
|
+
xSeconds: {
|
|
425
|
+
one: "1 second",
|
|
426
|
+
other: "{{count}} seconds"
|
|
427
|
+
},
|
|
428
|
+
halfAMinute: "half a minute",
|
|
429
|
+
lessThanXMinutes: {
|
|
430
|
+
one: "less than a minute",
|
|
431
|
+
other: "less than {{count}} minutes"
|
|
432
|
+
},
|
|
433
|
+
xMinutes: {
|
|
434
|
+
one: "1 minute",
|
|
435
|
+
other: "{{count}} minutes"
|
|
436
|
+
},
|
|
437
|
+
aboutXHours: {
|
|
438
|
+
one: "about 1 hour",
|
|
439
|
+
other: "about {{count}} hours"
|
|
440
|
+
},
|
|
441
|
+
xHours: {
|
|
442
|
+
one: "1 hour",
|
|
443
|
+
other: "{{count}} hours"
|
|
444
|
+
},
|
|
445
|
+
xDays: {
|
|
446
|
+
one: "1 day",
|
|
447
|
+
other: "{{count}} days"
|
|
448
|
+
},
|
|
449
|
+
aboutXWeeks: {
|
|
450
|
+
one: "about 1 week",
|
|
451
|
+
other: "about {{count}} weeks"
|
|
452
|
+
},
|
|
453
|
+
xWeeks: {
|
|
454
|
+
one: "1 week",
|
|
455
|
+
other: "{{count}} weeks"
|
|
456
|
+
},
|
|
457
|
+
aboutXMonths: {
|
|
458
|
+
one: "about 1 month",
|
|
459
|
+
other: "about {{count}} months"
|
|
460
|
+
},
|
|
461
|
+
xMonths: {
|
|
462
|
+
one: "1 month",
|
|
463
|
+
other: "{{count}} months"
|
|
464
|
+
},
|
|
465
|
+
aboutXYears: {
|
|
466
|
+
one: "about 1 year",
|
|
467
|
+
other: "about {{count}} years"
|
|
468
|
+
},
|
|
469
|
+
xYears: {
|
|
470
|
+
one: "1 year",
|
|
471
|
+
other: "{{count}} years"
|
|
472
|
+
},
|
|
473
|
+
overXYears: {
|
|
474
|
+
one: "over 1 year",
|
|
475
|
+
other: "over {{count}} years"
|
|
476
|
+
},
|
|
477
|
+
almostXYears: {
|
|
478
|
+
one: "almost 1 year",
|
|
479
|
+
other: "almost {{count}} years"
|
|
480
|
+
}
|
|
481
|
+
}, pt = (r, e, t) => {
|
|
482
|
+
let n;
|
|
483
|
+
const a = bt[r];
|
|
484
|
+
return typeof a == "string" ? n = a : e === 1 ? n = a.one : n = a.other.replace("{{count}}", e.toString()), t?.addSuffix ? t.comparison && t.comparison > 0 ? "in " + n : n + " ago" : n;
|
|
485
|
+
};
|
|
486
|
+
function B(r) {
|
|
487
|
+
return (e = {}) => {
|
|
488
|
+
const t = e.width ? String(e.width) : r.defaultWidth;
|
|
489
|
+
return r.formats[t] || r.formats[r.defaultWidth];
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
const xt = {
|
|
493
|
+
full: "EEEE, MMMM do, y",
|
|
494
|
+
long: "MMMM do, y",
|
|
495
|
+
medium: "MMM d, y",
|
|
496
|
+
short: "MM/dd/yyyy"
|
|
497
|
+
}, Mt = {
|
|
498
|
+
full: "h:mm:ss a zzzz",
|
|
499
|
+
long: "h:mm:ss a z",
|
|
500
|
+
medium: "h:mm:ss a",
|
|
501
|
+
short: "h:mm a"
|
|
502
|
+
}, Dt = {
|
|
503
|
+
full: "{{date}} 'at' {{time}}",
|
|
504
|
+
long: "{{date}} 'at' {{time}}",
|
|
505
|
+
medium: "{{date}}, {{time}}",
|
|
506
|
+
short: "{{date}}, {{time}}"
|
|
507
|
+
}, Pt = {
|
|
508
|
+
date: B({
|
|
509
|
+
formats: xt,
|
|
510
|
+
defaultWidth: "full"
|
|
511
|
+
}),
|
|
512
|
+
time: B({
|
|
513
|
+
formats: Mt,
|
|
514
|
+
defaultWidth: "full"
|
|
515
|
+
}),
|
|
516
|
+
dateTime: B({
|
|
517
|
+
formats: Dt,
|
|
518
|
+
defaultWidth: "full"
|
|
519
|
+
})
|
|
520
|
+
}, Tt = {
|
|
521
|
+
lastWeek: "'last' eeee 'at' p",
|
|
522
|
+
yesterday: "'yesterday at' p",
|
|
523
|
+
today: "'today at' p",
|
|
524
|
+
tomorrow: "'tomorrow at' p",
|
|
525
|
+
nextWeek: "eeee 'at' p",
|
|
526
|
+
other: "P"
|
|
527
|
+
}, kt = (r, e, t, n) => Tt[r];
|
|
528
|
+
function I(r) {
|
|
529
|
+
return (e, t) => {
|
|
530
|
+
const n = t?.context ? String(t.context) : "standalone";
|
|
531
|
+
let a;
|
|
532
|
+
if (n === "formatting" && r.formattingValues) {
|
|
533
|
+
const o = r.defaultFormattingWidth || r.defaultWidth, i = t?.width ? String(t.width) : o;
|
|
534
|
+
a = r.formattingValues[i] || r.formattingValues[o];
|
|
535
|
+
} else {
|
|
536
|
+
const o = r.defaultWidth, i = t?.width ? String(t.width) : r.defaultWidth;
|
|
537
|
+
a = r.values[i] || r.values[o];
|
|
538
|
+
}
|
|
539
|
+
const s = r.argumentCallback ? r.argumentCallback(e) : e;
|
|
540
|
+
return a[s];
|
|
541
|
+
};
|
|
542
|
+
}
|
|
543
|
+
const Ot = {
|
|
544
|
+
narrow: ["B", "A"],
|
|
545
|
+
abbreviated: ["BC", "AD"],
|
|
546
|
+
wide: ["Before Christ", "Anno Domini"]
|
|
547
|
+
}, Yt = {
|
|
548
|
+
narrow: ["1", "2", "3", "4"],
|
|
549
|
+
abbreviated: ["Q1", "Q2", "Q3", "Q4"],
|
|
550
|
+
wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
|
|
551
|
+
}, vt = {
|
|
552
|
+
narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
|
|
553
|
+
abbreviated: [
|
|
554
|
+
"Jan",
|
|
555
|
+
"Feb",
|
|
556
|
+
"Mar",
|
|
557
|
+
"Apr",
|
|
558
|
+
"May",
|
|
559
|
+
"Jun",
|
|
560
|
+
"Jul",
|
|
561
|
+
"Aug",
|
|
562
|
+
"Sep",
|
|
563
|
+
"Oct",
|
|
564
|
+
"Nov",
|
|
565
|
+
"Dec"
|
|
566
|
+
],
|
|
567
|
+
wide: [
|
|
568
|
+
"January",
|
|
569
|
+
"February",
|
|
570
|
+
"March",
|
|
571
|
+
"April",
|
|
572
|
+
"May",
|
|
573
|
+
"June",
|
|
574
|
+
"July",
|
|
575
|
+
"August",
|
|
576
|
+
"September",
|
|
577
|
+
"October",
|
|
578
|
+
"November",
|
|
579
|
+
"December"
|
|
580
|
+
]
|
|
581
|
+
}, _t = {
|
|
582
|
+
narrow: ["S", "M", "T", "W", "T", "F", "S"],
|
|
583
|
+
short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
|
|
584
|
+
abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
|
|
585
|
+
wide: [
|
|
586
|
+
"Sunday",
|
|
587
|
+
"Monday",
|
|
588
|
+
"Tuesday",
|
|
589
|
+
"Wednesday",
|
|
590
|
+
"Thursday",
|
|
591
|
+
"Friday",
|
|
592
|
+
"Saturday"
|
|
593
|
+
]
|
|
594
|
+
}, Et = {
|
|
595
|
+
narrow: {
|
|
596
|
+
am: "a",
|
|
597
|
+
pm: "p",
|
|
598
|
+
midnight: "mi",
|
|
599
|
+
noon: "n",
|
|
600
|
+
morning: "morning",
|
|
601
|
+
afternoon: "afternoon",
|
|
602
|
+
evening: "evening",
|
|
603
|
+
night: "night"
|
|
604
|
+
},
|
|
605
|
+
abbreviated: {
|
|
606
|
+
am: "AM",
|
|
607
|
+
pm: "PM",
|
|
608
|
+
midnight: "midnight",
|
|
609
|
+
noon: "noon",
|
|
610
|
+
morning: "morning",
|
|
611
|
+
afternoon: "afternoon",
|
|
612
|
+
evening: "evening",
|
|
613
|
+
night: "night"
|
|
614
|
+
},
|
|
615
|
+
wide: {
|
|
616
|
+
am: "a.m.",
|
|
617
|
+
pm: "p.m.",
|
|
618
|
+
midnight: "midnight",
|
|
619
|
+
noon: "noon",
|
|
620
|
+
morning: "morning",
|
|
621
|
+
afternoon: "afternoon",
|
|
622
|
+
evening: "evening",
|
|
623
|
+
night: "night"
|
|
624
|
+
}
|
|
625
|
+
}, Wt = {
|
|
626
|
+
narrow: {
|
|
627
|
+
am: "a",
|
|
628
|
+
pm: "p",
|
|
629
|
+
midnight: "mi",
|
|
630
|
+
noon: "n",
|
|
631
|
+
morning: "in the morning",
|
|
632
|
+
afternoon: "in the afternoon",
|
|
633
|
+
evening: "in the evening",
|
|
634
|
+
night: "at night"
|
|
635
|
+
},
|
|
636
|
+
abbreviated: {
|
|
637
|
+
am: "AM",
|
|
638
|
+
pm: "PM",
|
|
639
|
+
midnight: "midnight",
|
|
640
|
+
noon: "noon",
|
|
641
|
+
morning: "in the morning",
|
|
642
|
+
afternoon: "in the afternoon",
|
|
643
|
+
evening: "in the evening",
|
|
644
|
+
night: "at night"
|
|
645
|
+
},
|
|
646
|
+
wide: {
|
|
647
|
+
am: "a.m.",
|
|
648
|
+
pm: "p.m.",
|
|
649
|
+
midnight: "midnight",
|
|
650
|
+
noon: "noon",
|
|
651
|
+
morning: "in the morning",
|
|
652
|
+
afternoon: "in the afternoon",
|
|
653
|
+
evening: "in the evening",
|
|
654
|
+
night: "at night"
|
|
655
|
+
}
|
|
656
|
+
}, $t = (r, e) => {
|
|
657
|
+
const t = Number(r), n = t % 100;
|
|
658
|
+
if (n > 20 || n < 10)
|
|
659
|
+
switch (n % 10) {
|
|
660
|
+
case 1:
|
|
661
|
+
return t + "st";
|
|
662
|
+
case 2:
|
|
663
|
+
return t + "nd";
|
|
664
|
+
case 3:
|
|
665
|
+
return t + "rd";
|
|
666
|
+
}
|
|
667
|
+
return t + "th";
|
|
668
|
+
}, Nt = {
|
|
669
|
+
ordinalNumber: $t,
|
|
670
|
+
era: I({
|
|
671
|
+
values: Ot,
|
|
672
|
+
defaultWidth: "wide"
|
|
673
|
+
}),
|
|
674
|
+
quarter: I({
|
|
675
|
+
values: Yt,
|
|
676
|
+
defaultWidth: "wide",
|
|
677
|
+
argumentCallback: (r) => r - 1
|
|
678
|
+
}),
|
|
679
|
+
month: I({
|
|
680
|
+
values: vt,
|
|
681
|
+
defaultWidth: "wide"
|
|
682
|
+
}),
|
|
683
|
+
day: I({
|
|
684
|
+
values: _t,
|
|
685
|
+
defaultWidth: "wide"
|
|
686
|
+
}),
|
|
687
|
+
dayPeriod: I({
|
|
688
|
+
values: Et,
|
|
689
|
+
defaultWidth: "wide",
|
|
690
|
+
formattingValues: Wt,
|
|
691
|
+
defaultFormattingWidth: "wide"
|
|
692
|
+
})
|
|
693
|
+
};
|
|
694
|
+
function L(r) {
|
|
695
|
+
return (e, t = {}) => {
|
|
696
|
+
const n = t.width, a = n && r.matchPatterns[n] || r.matchPatterns[r.defaultMatchWidth], s = e.match(a);
|
|
697
|
+
if (!s)
|
|
698
|
+
return null;
|
|
699
|
+
const o = s[0], i = n && r.parsePatterns[n] || r.parsePatterns[r.defaultParseWidth], c = Array.isArray(i) ? Ht(i, (m) => m.test(o)) : (
|
|
700
|
+
// [TODO] -- I challenge you to fix the type
|
|
701
|
+
Ft(i, (m) => m.test(o))
|
|
702
|
+
);
|
|
703
|
+
let l;
|
|
704
|
+
l = r.valueCallback ? r.valueCallback(c) : c, l = t.valueCallback ? (
|
|
705
|
+
// [TODO] -- I challenge you to fix the type
|
|
706
|
+
t.valueCallback(l)
|
|
707
|
+
) : l;
|
|
708
|
+
const h = e.slice(o.length);
|
|
709
|
+
return { value: l, rest: h };
|
|
710
|
+
};
|
|
711
|
+
}
|
|
712
|
+
function Ft(r, e) {
|
|
713
|
+
for (const t in r)
|
|
714
|
+
if (Object.prototype.hasOwnProperty.call(r, t) && e(r[t]))
|
|
715
|
+
return t;
|
|
716
|
+
}
|
|
717
|
+
function Ht(r, e) {
|
|
718
|
+
for (let t = 0; t < r.length; t++)
|
|
719
|
+
if (e(r[t]))
|
|
720
|
+
return t;
|
|
721
|
+
}
|
|
722
|
+
function qt(r) {
|
|
723
|
+
return (e, t = {}) => {
|
|
724
|
+
const n = e.match(r.matchPattern);
|
|
725
|
+
if (!n) return null;
|
|
726
|
+
const a = n[0], s = e.match(r.parsePattern);
|
|
727
|
+
if (!s) return null;
|
|
728
|
+
let o = r.valueCallback ? r.valueCallback(s[0]) : s[0];
|
|
729
|
+
o = t.valueCallback ? t.valueCallback(o) : o;
|
|
730
|
+
const i = e.slice(a.length);
|
|
731
|
+
return { value: o, rest: i };
|
|
732
|
+
};
|
|
733
|
+
}
|
|
734
|
+
const It = /^(\d+)(th|st|nd|rd)?/i, Lt = /\d+/i, At = {
|
|
735
|
+
narrow: /^(b|a)/i,
|
|
736
|
+
abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
|
|
737
|
+
wide: /^(before christ|before common era|anno domini|common era)/i
|
|
738
|
+
}, Ct = {
|
|
739
|
+
any: [/^b/i, /^(a|c)/i]
|
|
740
|
+
}, Rt = {
|
|
741
|
+
narrow: /^[1234]/i,
|
|
742
|
+
abbreviated: /^q[1234]/i,
|
|
743
|
+
wide: /^[1234](th|st|nd|rd)? quarter/i
|
|
744
|
+
}, Qt = {
|
|
745
|
+
any: [/1/i, /2/i, /3/i, /4/i]
|
|
746
|
+
}, Bt = {
|
|
747
|
+
narrow: /^[jfmasond]/i,
|
|
748
|
+
abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
|
|
749
|
+
wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
|
|
750
|
+
}, zt = {
|
|
751
|
+
narrow: [
|
|
752
|
+
/^j/i,
|
|
753
|
+
/^f/i,
|
|
754
|
+
/^m/i,
|
|
755
|
+
/^a/i,
|
|
756
|
+
/^m/i,
|
|
757
|
+
/^j/i,
|
|
758
|
+
/^j/i,
|
|
759
|
+
/^a/i,
|
|
760
|
+
/^s/i,
|
|
761
|
+
/^o/i,
|
|
762
|
+
/^n/i,
|
|
763
|
+
/^d/i
|
|
764
|
+
],
|
|
765
|
+
any: [
|
|
766
|
+
/^ja/i,
|
|
767
|
+
/^f/i,
|
|
768
|
+
/^mar/i,
|
|
769
|
+
/^ap/i,
|
|
770
|
+
/^may/i,
|
|
771
|
+
/^jun/i,
|
|
772
|
+
/^jul/i,
|
|
773
|
+
/^au/i,
|
|
774
|
+
/^s/i,
|
|
775
|
+
/^o/i,
|
|
776
|
+
/^n/i,
|
|
777
|
+
/^d/i
|
|
778
|
+
]
|
|
779
|
+
}, Xt = {
|
|
780
|
+
narrow: /^[smtwf]/i,
|
|
781
|
+
short: /^(su|mo|tu|we|th|fr|sa)/i,
|
|
782
|
+
abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
|
|
783
|
+
wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
|
|
784
|
+
}, jt = {
|
|
785
|
+
narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
|
|
786
|
+
any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
|
|
787
|
+
}, Gt = {
|
|
788
|
+
narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
|
|
789
|
+
any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
|
|
790
|
+
}, Vt = {
|
|
791
|
+
any: {
|
|
792
|
+
am: /^a/i,
|
|
793
|
+
pm: /^p/i,
|
|
794
|
+
midnight: /^mi/i,
|
|
795
|
+
noon: /^no/i,
|
|
796
|
+
morning: /morning/i,
|
|
797
|
+
afternoon: /afternoon/i,
|
|
798
|
+
evening: /evening/i,
|
|
799
|
+
night: /night/i
|
|
800
|
+
}
|
|
801
|
+
}, Zt = {
|
|
802
|
+
ordinalNumber: qt({
|
|
803
|
+
matchPattern: It,
|
|
804
|
+
parsePattern: Lt,
|
|
805
|
+
valueCallback: (r) => parseInt(r, 10)
|
|
806
|
+
}),
|
|
807
|
+
era: L({
|
|
808
|
+
matchPatterns: At,
|
|
809
|
+
defaultMatchWidth: "wide",
|
|
810
|
+
parsePatterns: Ct,
|
|
811
|
+
defaultParseWidth: "any"
|
|
812
|
+
}),
|
|
813
|
+
quarter: L({
|
|
814
|
+
matchPatterns: Rt,
|
|
815
|
+
defaultMatchWidth: "wide",
|
|
816
|
+
parsePatterns: Qt,
|
|
817
|
+
defaultParseWidth: "any",
|
|
818
|
+
valueCallback: (r) => r + 1
|
|
819
|
+
}),
|
|
820
|
+
month: L({
|
|
821
|
+
matchPatterns: Bt,
|
|
822
|
+
defaultMatchWidth: "wide",
|
|
823
|
+
parsePatterns: zt,
|
|
824
|
+
defaultParseWidth: "any"
|
|
825
|
+
}),
|
|
826
|
+
day: L({
|
|
827
|
+
matchPatterns: Xt,
|
|
828
|
+
defaultMatchWidth: "wide",
|
|
829
|
+
parsePatterns: jt,
|
|
830
|
+
defaultParseWidth: "any"
|
|
831
|
+
}),
|
|
832
|
+
dayPeriod: L({
|
|
833
|
+
matchPatterns: Gt,
|
|
834
|
+
defaultMatchWidth: "any",
|
|
835
|
+
parsePatterns: Vt,
|
|
836
|
+
defaultParseWidth: "any"
|
|
837
|
+
})
|
|
838
|
+
}, be = {
|
|
839
|
+
code: "en-US",
|
|
840
|
+
formatDistance: pt,
|
|
841
|
+
formatLong: Pt,
|
|
842
|
+
formatRelative: kt,
|
|
843
|
+
localize: Nt,
|
|
844
|
+
match: Zt,
|
|
845
|
+
options: {
|
|
846
|
+
weekStartsOn: 0,
|
|
847
|
+
firstWeekContainsDate: 1
|
|
848
|
+
}
|
|
151
849
|
};
|
|
850
|
+
function Kt(r, e) {
|
|
851
|
+
const t = w(r, e?.in);
|
|
852
|
+
return ge(t, yt(t)) + 1;
|
|
853
|
+
}
|
|
854
|
+
function pe(r, e) {
|
|
855
|
+
const t = w(r, e?.in), n = +H(t) - +rt(t);
|
|
856
|
+
return Math.round(n / le) + 1;
|
|
857
|
+
}
|
|
858
|
+
function V(r, e) {
|
|
859
|
+
const t = w(r, e?.in), n = t.getFullYear(), a = q(), s = e?.firstWeekContainsDate ?? e?.locale?.options?.firstWeekContainsDate ?? a.firstWeekContainsDate ?? a.locale?.options?.firstWeekContainsDate ?? 1, o = P(e?.in || r, 0);
|
|
860
|
+
o.setFullYear(n + 1, 0, s), o.setHours(0, 0, 0, 0);
|
|
861
|
+
const i = E(o, e), c = P(e?.in || r, 0);
|
|
862
|
+
c.setFullYear(n, 0, s), c.setHours(0, 0, 0, 0);
|
|
863
|
+
const l = E(c, e);
|
|
864
|
+
return +t >= +i ? n + 1 : +t >= +l ? n : n - 1;
|
|
865
|
+
}
|
|
866
|
+
function Jt(r, e) {
|
|
867
|
+
const t = q(), n = e?.firstWeekContainsDate ?? e?.locale?.options?.firstWeekContainsDate ?? t.firstWeekContainsDate ?? t.locale?.options?.firstWeekContainsDate ?? 1, a = V(r, e), s = P(e?.in || r, 0);
|
|
868
|
+
return s.setFullYear(a, 0, n), s.setHours(0, 0, 0, 0), E(s, e);
|
|
869
|
+
}
|
|
870
|
+
function xe(r, e) {
|
|
871
|
+
const t = w(r, e?.in), n = +E(t, e) - +Jt(t, e);
|
|
872
|
+
return Math.round(n / le) + 1;
|
|
873
|
+
}
|
|
874
|
+
function d(r, e) {
|
|
875
|
+
const t = r < 0 ? "-" : "", n = Math.abs(r).toString().padStart(e, "0");
|
|
876
|
+
return t + n;
|
|
877
|
+
}
|
|
878
|
+
const _ = {
|
|
879
|
+
// Year
|
|
880
|
+
y(r, e) {
|
|
881
|
+
const t = r.getFullYear(), n = t > 0 ? t : 1 - t;
|
|
882
|
+
return d(e === "yy" ? n % 100 : n, e.length);
|
|
883
|
+
},
|
|
884
|
+
// Month
|
|
885
|
+
M(r, e) {
|
|
886
|
+
const t = r.getMonth();
|
|
887
|
+
return e === "M" ? String(t + 1) : d(t + 1, 2);
|
|
888
|
+
},
|
|
889
|
+
// Day of the month
|
|
890
|
+
d(r, e) {
|
|
891
|
+
return d(r.getDate(), e.length);
|
|
892
|
+
},
|
|
893
|
+
// AM or PM
|
|
894
|
+
a(r, e) {
|
|
895
|
+
const t = r.getHours() / 12 >= 1 ? "pm" : "am";
|
|
896
|
+
switch (e) {
|
|
897
|
+
case "a":
|
|
898
|
+
case "aa":
|
|
899
|
+
return t.toUpperCase();
|
|
900
|
+
case "aaa":
|
|
901
|
+
return t;
|
|
902
|
+
case "aaaaa":
|
|
903
|
+
return t[0];
|
|
904
|
+
case "aaaa":
|
|
905
|
+
default:
|
|
906
|
+
return t === "am" ? "a.m." : "p.m.";
|
|
907
|
+
}
|
|
908
|
+
},
|
|
909
|
+
// Hour [1-12]
|
|
910
|
+
h(r, e) {
|
|
911
|
+
return d(r.getHours() % 12 || 12, e.length);
|
|
912
|
+
},
|
|
913
|
+
// Hour [0-23]
|
|
914
|
+
H(r, e) {
|
|
915
|
+
return d(r.getHours(), e.length);
|
|
916
|
+
},
|
|
917
|
+
// Minute
|
|
918
|
+
m(r, e) {
|
|
919
|
+
return d(r.getMinutes(), e.length);
|
|
920
|
+
},
|
|
921
|
+
// Second
|
|
922
|
+
s(r, e) {
|
|
923
|
+
return d(r.getSeconds(), e.length);
|
|
924
|
+
},
|
|
925
|
+
// Fraction of second
|
|
926
|
+
S(r, e) {
|
|
927
|
+
const t = e.length, n = r.getMilliseconds(), a = Math.trunc(
|
|
928
|
+
n * Math.pow(10, t - 3)
|
|
929
|
+
);
|
|
930
|
+
return d(a, e.length);
|
|
931
|
+
}
|
|
932
|
+
}, F = {
|
|
933
|
+
midnight: "midnight",
|
|
934
|
+
noon: "noon",
|
|
935
|
+
morning: "morning",
|
|
936
|
+
afternoon: "afternoon",
|
|
937
|
+
evening: "evening",
|
|
938
|
+
night: "night"
|
|
939
|
+
}, re = {
|
|
940
|
+
// Era
|
|
941
|
+
G: function(r, e, t) {
|
|
942
|
+
const n = r.getFullYear() > 0 ? 1 : 0;
|
|
943
|
+
switch (e) {
|
|
944
|
+
// AD, BC
|
|
945
|
+
case "G":
|
|
946
|
+
case "GG":
|
|
947
|
+
case "GGG":
|
|
948
|
+
return t.era(n, { width: "abbreviated" });
|
|
949
|
+
// A, B
|
|
950
|
+
case "GGGGG":
|
|
951
|
+
return t.era(n, { width: "narrow" });
|
|
952
|
+
// Anno Domini, Before Christ
|
|
953
|
+
case "GGGG":
|
|
954
|
+
default:
|
|
955
|
+
return t.era(n, { width: "wide" });
|
|
956
|
+
}
|
|
957
|
+
},
|
|
958
|
+
// Year
|
|
959
|
+
y: function(r, e, t) {
|
|
960
|
+
if (e === "yo") {
|
|
961
|
+
const n = r.getFullYear(), a = n > 0 ? n : 1 - n;
|
|
962
|
+
return t.ordinalNumber(a, { unit: "year" });
|
|
963
|
+
}
|
|
964
|
+
return _.y(r, e);
|
|
965
|
+
},
|
|
966
|
+
// Local week-numbering year
|
|
967
|
+
Y: function(r, e, t, n) {
|
|
968
|
+
const a = V(r, n), s = a > 0 ? a : 1 - a;
|
|
969
|
+
if (e === "YY") {
|
|
970
|
+
const o = s % 100;
|
|
971
|
+
return d(o, 2);
|
|
972
|
+
}
|
|
973
|
+
return e === "Yo" ? t.ordinalNumber(s, { unit: "year" }) : d(s, e.length);
|
|
974
|
+
},
|
|
975
|
+
// ISO week-numbering year
|
|
976
|
+
R: function(r, e) {
|
|
977
|
+
const t = we(r);
|
|
978
|
+
return d(t, e.length);
|
|
979
|
+
},
|
|
980
|
+
// Extended year. This is a single number designating the year of this calendar system.
|
|
981
|
+
// The main difference between `y` and `u` localizers are B.C. years:
|
|
982
|
+
// | Year | `y` | `u` |
|
|
983
|
+
// |------|-----|-----|
|
|
984
|
+
// | AC 1 | 1 | 1 |
|
|
985
|
+
// | BC 1 | 1 | 0 |
|
|
986
|
+
// | BC 2 | 2 | -1 |
|
|
987
|
+
// Also `yy` always returns the last two digits of a year,
|
|
988
|
+
// while `uu` pads single digit years to 2 characters and returns other years unchanged.
|
|
989
|
+
u: function(r, e) {
|
|
990
|
+
const t = r.getFullYear();
|
|
991
|
+
return d(t, e.length);
|
|
992
|
+
},
|
|
993
|
+
// Quarter
|
|
994
|
+
Q: function(r, e, t) {
|
|
995
|
+
const n = Math.ceil((r.getMonth() + 1) / 3);
|
|
996
|
+
switch (e) {
|
|
997
|
+
// 1, 2, 3, 4
|
|
998
|
+
case "Q":
|
|
999
|
+
return String(n);
|
|
1000
|
+
// 01, 02, 03, 04
|
|
1001
|
+
case "QQ":
|
|
1002
|
+
return d(n, 2);
|
|
1003
|
+
// 1st, 2nd, 3rd, 4th
|
|
1004
|
+
case "Qo":
|
|
1005
|
+
return t.ordinalNumber(n, { unit: "quarter" });
|
|
1006
|
+
// Q1, Q2, Q3, Q4
|
|
1007
|
+
case "QQQ":
|
|
1008
|
+
return t.quarter(n, {
|
|
1009
|
+
width: "abbreviated",
|
|
1010
|
+
context: "formatting"
|
|
1011
|
+
});
|
|
1012
|
+
// 1, 2, 3, 4 (narrow quarter; could be not numerical)
|
|
1013
|
+
case "QQQQQ":
|
|
1014
|
+
return t.quarter(n, {
|
|
1015
|
+
width: "narrow",
|
|
1016
|
+
context: "formatting"
|
|
1017
|
+
});
|
|
1018
|
+
// 1st quarter, 2nd quarter, ...
|
|
1019
|
+
case "QQQQ":
|
|
1020
|
+
default:
|
|
1021
|
+
return t.quarter(n, {
|
|
1022
|
+
width: "wide",
|
|
1023
|
+
context: "formatting"
|
|
1024
|
+
});
|
|
1025
|
+
}
|
|
1026
|
+
},
|
|
1027
|
+
// Stand-alone quarter
|
|
1028
|
+
q: function(r, e, t) {
|
|
1029
|
+
const n = Math.ceil((r.getMonth() + 1) / 3);
|
|
1030
|
+
switch (e) {
|
|
1031
|
+
// 1, 2, 3, 4
|
|
1032
|
+
case "q":
|
|
1033
|
+
return String(n);
|
|
1034
|
+
// 01, 02, 03, 04
|
|
1035
|
+
case "qq":
|
|
1036
|
+
return d(n, 2);
|
|
1037
|
+
// 1st, 2nd, 3rd, 4th
|
|
1038
|
+
case "qo":
|
|
1039
|
+
return t.ordinalNumber(n, { unit: "quarter" });
|
|
1040
|
+
// Q1, Q2, Q3, Q4
|
|
1041
|
+
case "qqq":
|
|
1042
|
+
return t.quarter(n, {
|
|
1043
|
+
width: "abbreviated",
|
|
1044
|
+
context: "standalone"
|
|
1045
|
+
});
|
|
1046
|
+
// 1, 2, 3, 4 (narrow quarter; could be not numerical)
|
|
1047
|
+
case "qqqqq":
|
|
1048
|
+
return t.quarter(n, {
|
|
1049
|
+
width: "narrow",
|
|
1050
|
+
context: "standalone"
|
|
1051
|
+
});
|
|
1052
|
+
// 1st quarter, 2nd quarter, ...
|
|
1053
|
+
case "qqqq":
|
|
1054
|
+
default:
|
|
1055
|
+
return t.quarter(n, {
|
|
1056
|
+
width: "wide",
|
|
1057
|
+
context: "standalone"
|
|
1058
|
+
});
|
|
1059
|
+
}
|
|
1060
|
+
},
|
|
1061
|
+
// Month
|
|
1062
|
+
M: function(r, e, t) {
|
|
1063
|
+
const n = r.getMonth();
|
|
1064
|
+
switch (e) {
|
|
1065
|
+
case "M":
|
|
1066
|
+
case "MM":
|
|
1067
|
+
return _.M(r, e);
|
|
1068
|
+
// 1st, 2nd, ..., 12th
|
|
1069
|
+
case "Mo":
|
|
1070
|
+
return t.ordinalNumber(n + 1, { unit: "month" });
|
|
1071
|
+
// Jan, Feb, ..., Dec
|
|
1072
|
+
case "MMM":
|
|
1073
|
+
return t.month(n, {
|
|
1074
|
+
width: "abbreviated",
|
|
1075
|
+
context: "formatting"
|
|
1076
|
+
});
|
|
1077
|
+
// J, F, ..., D
|
|
1078
|
+
case "MMMMM":
|
|
1079
|
+
return t.month(n, {
|
|
1080
|
+
width: "narrow",
|
|
1081
|
+
context: "formatting"
|
|
1082
|
+
});
|
|
1083
|
+
// January, February, ..., December
|
|
1084
|
+
case "MMMM":
|
|
1085
|
+
default:
|
|
1086
|
+
return t.month(n, { width: "wide", context: "formatting" });
|
|
1087
|
+
}
|
|
1088
|
+
},
|
|
1089
|
+
// Stand-alone month
|
|
1090
|
+
L: function(r, e, t) {
|
|
1091
|
+
const n = r.getMonth();
|
|
1092
|
+
switch (e) {
|
|
1093
|
+
// 1, 2, ..., 12
|
|
1094
|
+
case "L":
|
|
1095
|
+
return String(n + 1);
|
|
1096
|
+
// 01, 02, ..., 12
|
|
1097
|
+
case "LL":
|
|
1098
|
+
return d(n + 1, 2);
|
|
1099
|
+
// 1st, 2nd, ..., 12th
|
|
1100
|
+
case "Lo":
|
|
1101
|
+
return t.ordinalNumber(n + 1, { unit: "month" });
|
|
1102
|
+
// Jan, Feb, ..., Dec
|
|
1103
|
+
case "LLL":
|
|
1104
|
+
return t.month(n, {
|
|
1105
|
+
width: "abbreviated",
|
|
1106
|
+
context: "standalone"
|
|
1107
|
+
});
|
|
1108
|
+
// J, F, ..., D
|
|
1109
|
+
case "LLLLL":
|
|
1110
|
+
return t.month(n, {
|
|
1111
|
+
width: "narrow",
|
|
1112
|
+
context: "standalone"
|
|
1113
|
+
});
|
|
1114
|
+
// January, February, ..., December
|
|
1115
|
+
case "LLLL":
|
|
1116
|
+
default:
|
|
1117
|
+
return t.month(n, { width: "wide", context: "standalone" });
|
|
1118
|
+
}
|
|
1119
|
+
},
|
|
1120
|
+
// Local week of year
|
|
1121
|
+
w: function(r, e, t, n) {
|
|
1122
|
+
const a = xe(r, n);
|
|
1123
|
+
return e === "wo" ? t.ordinalNumber(a, { unit: "week" }) : d(a, e.length);
|
|
1124
|
+
},
|
|
1125
|
+
// ISO week of year
|
|
1126
|
+
I: function(r, e, t) {
|
|
1127
|
+
const n = pe(r);
|
|
1128
|
+
return e === "Io" ? t.ordinalNumber(n, { unit: "week" }) : d(n, e.length);
|
|
1129
|
+
},
|
|
1130
|
+
// Day of the month
|
|
1131
|
+
d: function(r, e, t) {
|
|
1132
|
+
return e === "do" ? t.ordinalNumber(r.getDate(), { unit: "date" }) : _.d(r, e);
|
|
1133
|
+
},
|
|
1134
|
+
// Day of year
|
|
1135
|
+
D: function(r, e, t) {
|
|
1136
|
+
const n = Kt(r);
|
|
1137
|
+
return e === "Do" ? t.ordinalNumber(n, { unit: "dayOfYear" }) : d(n, e.length);
|
|
1138
|
+
},
|
|
1139
|
+
// Day of week
|
|
1140
|
+
E: function(r, e, t) {
|
|
1141
|
+
const n = r.getDay();
|
|
1142
|
+
switch (e) {
|
|
1143
|
+
// Tue
|
|
1144
|
+
case "E":
|
|
1145
|
+
case "EE":
|
|
1146
|
+
case "EEE":
|
|
1147
|
+
return t.day(n, {
|
|
1148
|
+
width: "abbreviated",
|
|
1149
|
+
context: "formatting"
|
|
1150
|
+
});
|
|
1151
|
+
// T
|
|
1152
|
+
case "EEEEE":
|
|
1153
|
+
return t.day(n, {
|
|
1154
|
+
width: "narrow",
|
|
1155
|
+
context: "formatting"
|
|
1156
|
+
});
|
|
1157
|
+
// Tu
|
|
1158
|
+
case "EEEEEE":
|
|
1159
|
+
return t.day(n, {
|
|
1160
|
+
width: "short",
|
|
1161
|
+
context: "formatting"
|
|
1162
|
+
});
|
|
1163
|
+
// Tuesday
|
|
1164
|
+
case "EEEE":
|
|
1165
|
+
default:
|
|
1166
|
+
return t.day(n, {
|
|
1167
|
+
width: "wide",
|
|
1168
|
+
context: "formatting"
|
|
1169
|
+
});
|
|
1170
|
+
}
|
|
1171
|
+
},
|
|
1172
|
+
// Local day of week
|
|
1173
|
+
e: function(r, e, t, n) {
|
|
1174
|
+
const a = r.getDay(), s = (a - n.weekStartsOn + 8) % 7 || 7;
|
|
1175
|
+
switch (e) {
|
|
1176
|
+
// Numerical value (Nth day of week with current locale or weekStartsOn)
|
|
1177
|
+
case "e":
|
|
1178
|
+
return String(s);
|
|
1179
|
+
// Padded numerical value
|
|
1180
|
+
case "ee":
|
|
1181
|
+
return d(s, 2);
|
|
1182
|
+
// 1st, 2nd, ..., 7th
|
|
1183
|
+
case "eo":
|
|
1184
|
+
return t.ordinalNumber(s, { unit: "day" });
|
|
1185
|
+
case "eee":
|
|
1186
|
+
return t.day(a, {
|
|
1187
|
+
width: "abbreviated",
|
|
1188
|
+
context: "formatting"
|
|
1189
|
+
});
|
|
1190
|
+
// T
|
|
1191
|
+
case "eeeee":
|
|
1192
|
+
return t.day(a, {
|
|
1193
|
+
width: "narrow",
|
|
1194
|
+
context: "formatting"
|
|
1195
|
+
});
|
|
1196
|
+
// Tu
|
|
1197
|
+
case "eeeeee":
|
|
1198
|
+
return t.day(a, {
|
|
1199
|
+
width: "short",
|
|
1200
|
+
context: "formatting"
|
|
1201
|
+
});
|
|
1202
|
+
// Tuesday
|
|
1203
|
+
case "eeee":
|
|
1204
|
+
default:
|
|
1205
|
+
return t.day(a, {
|
|
1206
|
+
width: "wide",
|
|
1207
|
+
context: "formatting"
|
|
1208
|
+
});
|
|
1209
|
+
}
|
|
1210
|
+
},
|
|
1211
|
+
// Stand-alone local day of week
|
|
1212
|
+
c: function(r, e, t, n) {
|
|
1213
|
+
const a = r.getDay(), s = (a - n.weekStartsOn + 8) % 7 || 7;
|
|
1214
|
+
switch (e) {
|
|
1215
|
+
// Numerical value (same as in `e`)
|
|
1216
|
+
case "c":
|
|
1217
|
+
return String(s);
|
|
1218
|
+
// Padded numerical value
|
|
1219
|
+
case "cc":
|
|
1220
|
+
return d(s, e.length);
|
|
1221
|
+
// 1st, 2nd, ..., 7th
|
|
1222
|
+
case "co":
|
|
1223
|
+
return t.ordinalNumber(s, { unit: "day" });
|
|
1224
|
+
case "ccc":
|
|
1225
|
+
return t.day(a, {
|
|
1226
|
+
width: "abbreviated",
|
|
1227
|
+
context: "standalone"
|
|
1228
|
+
});
|
|
1229
|
+
// T
|
|
1230
|
+
case "ccccc":
|
|
1231
|
+
return t.day(a, {
|
|
1232
|
+
width: "narrow",
|
|
1233
|
+
context: "standalone"
|
|
1234
|
+
});
|
|
1235
|
+
// Tu
|
|
1236
|
+
case "cccccc":
|
|
1237
|
+
return t.day(a, {
|
|
1238
|
+
width: "short",
|
|
1239
|
+
context: "standalone"
|
|
1240
|
+
});
|
|
1241
|
+
// Tuesday
|
|
1242
|
+
case "cccc":
|
|
1243
|
+
default:
|
|
1244
|
+
return t.day(a, {
|
|
1245
|
+
width: "wide",
|
|
1246
|
+
context: "standalone"
|
|
1247
|
+
});
|
|
1248
|
+
}
|
|
1249
|
+
},
|
|
1250
|
+
// ISO day of week
|
|
1251
|
+
i: function(r, e, t) {
|
|
1252
|
+
const n = r.getDay(), a = n === 0 ? 7 : n;
|
|
1253
|
+
switch (e) {
|
|
1254
|
+
// 2
|
|
1255
|
+
case "i":
|
|
1256
|
+
return String(a);
|
|
1257
|
+
// 02
|
|
1258
|
+
case "ii":
|
|
1259
|
+
return d(a, e.length);
|
|
1260
|
+
// 2nd
|
|
1261
|
+
case "io":
|
|
1262
|
+
return t.ordinalNumber(a, { unit: "day" });
|
|
1263
|
+
// Tue
|
|
1264
|
+
case "iii":
|
|
1265
|
+
return t.day(n, {
|
|
1266
|
+
width: "abbreviated",
|
|
1267
|
+
context: "formatting"
|
|
1268
|
+
});
|
|
1269
|
+
// T
|
|
1270
|
+
case "iiiii":
|
|
1271
|
+
return t.day(n, {
|
|
1272
|
+
width: "narrow",
|
|
1273
|
+
context: "formatting"
|
|
1274
|
+
});
|
|
1275
|
+
// Tu
|
|
1276
|
+
case "iiiiii":
|
|
1277
|
+
return t.day(n, {
|
|
1278
|
+
width: "short",
|
|
1279
|
+
context: "formatting"
|
|
1280
|
+
});
|
|
1281
|
+
// Tuesday
|
|
1282
|
+
case "iiii":
|
|
1283
|
+
default:
|
|
1284
|
+
return t.day(n, {
|
|
1285
|
+
width: "wide",
|
|
1286
|
+
context: "formatting"
|
|
1287
|
+
});
|
|
1288
|
+
}
|
|
1289
|
+
},
|
|
1290
|
+
// AM or PM
|
|
1291
|
+
a: function(r, e, t) {
|
|
1292
|
+
const a = r.getHours() / 12 >= 1 ? "pm" : "am";
|
|
1293
|
+
switch (e) {
|
|
1294
|
+
case "a":
|
|
1295
|
+
case "aa":
|
|
1296
|
+
return t.dayPeriod(a, {
|
|
1297
|
+
width: "abbreviated",
|
|
1298
|
+
context: "formatting"
|
|
1299
|
+
});
|
|
1300
|
+
case "aaa":
|
|
1301
|
+
return t.dayPeriod(a, {
|
|
1302
|
+
width: "abbreviated",
|
|
1303
|
+
context: "formatting"
|
|
1304
|
+
}).toLowerCase();
|
|
1305
|
+
case "aaaaa":
|
|
1306
|
+
return t.dayPeriod(a, {
|
|
1307
|
+
width: "narrow",
|
|
1308
|
+
context: "formatting"
|
|
1309
|
+
});
|
|
1310
|
+
case "aaaa":
|
|
1311
|
+
default:
|
|
1312
|
+
return t.dayPeriod(a, {
|
|
1313
|
+
width: "wide",
|
|
1314
|
+
context: "formatting"
|
|
1315
|
+
});
|
|
1316
|
+
}
|
|
1317
|
+
},
|
|
1318
|
+
// AM, PM, midnight, noon
|
|
1319
|
+
b: function(r, e, t) {
|
|
1320
|
+
const n = r.getHours();
|
|
1321
|
+
let a;
|
|
1322
|
+
switch (n === 12 ? a = F.noon : n === 0 ? a = F.midnight : a = n / 12 >= 1 ? "pm" : "am", e) {
|
|
1323
|
+
case "b":
|
|
1324
|
+
case "bb":
|
|
1325
|
+
return t.dayPeriod(a, {
|
|
1326
|
+
width: "abbreviated",
|
|
1327
|
+
context: "formatting"
|
|
1328
|
+
});
|
|
1329
|
+
case "bbb":
|
|
1330
|
+
return t.dayPeriod(a, {
|
|
1331
|
+
width: "abbreviated",
|
|
1332
|
+
context: "formatting"
|
|
1333
|
+
}).toLowerCase();
|
|
1334
|
+
case "bbbbb":
|
|
1335
|
+
return t.dayPeriod(a, {
|
|
1336
|
+
width: "narrow",
|
|
1337
|
+
context: "formatting"
|
|
1338
|
+
});
|
|
1339
|
+
case "bbbb":
|
|
1340
|
+
default:
|
|
1341
|
+
return t.dayPeriod(a, {
|
|
1342
|
+
width: "wide",
|
|
1343
|
+
context: "formatting"
|
|
1344
|
+
});
|
|
1345
|
+
}
|
|
1346
|
+
},
|
|
1347
|
+
// in the morning, in the afternoon, in the evening, at night
|
|
1348
|
+
B: function(r, e, t) {
|
|
1349
|
+
const n = r.getHours();
|
|
1350
|
+
let a;
|
|
1351
|
+
switch (n >= 17 ? a = F.evening : n >= 12 ? a = F.afternoon : n >= 4 ? a = F.morning : a = F.night, e) {
|
|
1352
|
+
case "B":
|
|
1353
|
+
case "BB":
|
|
1354
|
+
case "BBB":
|
|
1355
|
+
return t.dayPeriod(a, {
|
|
1356
|
+
width: "abbreviated",
|
|
1357
|
+
context: "formatting"
|
|
1358
|
+
});
|
|
1359
|
+
case "BBBBB":
|
|
1360
|
+
return t.dayPeriod(a, {
|
|
1361
|
+
width: "narrow",
|
|
1362
|
+
context: "formatting"
|
|
1363
|
+
});
|
|
1364
|
+
case "BBBB":
|
|
1365
|
+
default:
|
|
1366
|
+
return t.dayPeriod(a, {
|
|
1367
|
+
width: "wide",
|
|
1368
|
+
context: "formatting"
|
|
1369
|
+
});
|
|
1370
|
+
}
|
|
1371
|
+
},
|
|
1372
|
+
// Hour [1-12]
|
|
1373
|
+
h: function(r, e, t) {
|
|
1374
|
+
if (e === "ho") {
|
|
1375
|
+
let n = r.getHours() % 12;
|
|
1376
|
+
return n === 0 && (n = 12), t.ordinalNumber(n, { unit: "hour" });
|
|
1377
|
+
}
|
|
1378
|
+
return _.h(r, e);
|
|
1379
|
+
},
|
|
1380
|
+
// Hour [0-23]
|
|
1381
|
+
H: function(r, e, t) {
|
|
1382
|
+
return e === "Ho" ? t.ordinalNumber(r.getHours(), { unit: "hour" }) : _.H(r, e);
|
|
1383
|
+
},
|
|
1384
|
+
// Hour [0-11]
|
|
1385
|
+
K: function(r, e, t) {
|
|
1386
|
+
const n = r.getHours() % 12;
|
|
1387
|
+
return e === "Ko" ? t.ordinalNumber(n, { unit: "hour" }) : d(n, e.length);
|
|
1388
|
+
},
|
|
1389
|
+
// Hour [1-24]
|
|
1390
|
+
k: function(r, e, t) {
|
|
1391
|
+
let n = r.getHours();
|
|
1392
|
+
return n === 0 && (n = 24), e === "ko" ? t.ordinalNumber(n, { unit: "hour" }) : d(n, e.length);
|
|
1393
|
+
},
|
|
1394
|
+
// Minute
|
|
1395
|
+
m: function(r, e, t) {
|
|
1396
|
+
return e === "mo" ? t.ordinalNumber(r.getMinutes(), { unit: "minute" }) : _.m(r, e);
|
|
1397
|
+
},
|
|
1398
|
+
// Second
|
|
1399
|
+
s: function(r, e, t) {
|
|
1400
|
+
return e === "so" ? t.ordinalNumber(r.getSeconds(), { unit: "second" }) : _.s(r, e);
|
|
1401
|
+
},
|
|
1402
|
+
// Fraction of second
|
|
1403
|
+
S: function(r, e) {
|
|
1404
|
+
return _.S(r, e);
|
|
1405
|
+
},
|
|
1406
|
+
// Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
|
|
1407
|
+
X: function(r, e, t) {
|
|
1408
|
+
const n = r.getTimezoneOffset();
|
|
1409
|
+
if (n === 0)
|
|
1410
|
+
return "Z";
|
|
1411
|
+
switch (e) {
|
|
1412
|
+
// Hours and optional minutes
|
|
1413
|
+
case "X":
|
|
1414
|
+
return se(n);
|
|
1415
|
+
// Hours, minutes and optional seconds without `:` delimiter
|
|
1416
|
+
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
1417
|
+
// so this token always has the same output as `XX`
|
|
1418
|
+
case "XXXX":
|
|
1419
|
+
case "XX":
|
|
1420
|
+
return $(n);
|
|
1421
|
+
// Hours, minutes and optional seconds with `:` delimiter
|
|
1422
|
+
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
1423
|
+
// so this token always has the same output as `XXX`
|
|
1424
|
+
case "XXXXX":
|
|
1425
|
+
case "XXX":
|
|
1426
|
+
// Hours and minutes with `:` delimiter
|
|
1427
|
+
default:
|
|
1428
|
+
return $(n, ":");
|
|
1429
|
+
}
|
|
1430
|
+
},
|
|
1431
|
+
// Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
|
|
1432
|
+
x: function(r, e, t) {
|
|
1433
|
+
const n = r.getTimezoneOffset();
|
|
1434
|
+
switch (e) {
|
|
1435
|
+
// Hours and optional minutes
|
|
1436
|
+
case "x":
|
|
1437
|
+
return se(n);
|
|
1438
|
+
// Hours, minutes and optional seconds without `:` delimiter
|
|
1439
|
+
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
1440
|
+
// so this token always has the same output as `xx`
|
|
1441
|
+
case "xxxx":
|
|
1442
|
+
case "xx":
|
|
1443
|
+
return $(n);
|
|
1444
|
+
// Hours, minutes and optional seconds with `:` delimiter
|
|
1445
|
+
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
1446
|
+
// so this token always has the same output as `xxx`
|
|
1447
|
+
case "xxxxx":
|
|
1448
|
+
case "xxx":
|
|
1449
|
+
// Hours and minutes with `:` delimiter
|
|
1450
|
+
default:
|
|
1451
|
+
return $(n, ":");
|
|
1452
|
+
}
|
|
1453
|
+
},
|
|
1454
|
+
// Timezone (GMT)
|
|
1455
|
+
O: function(r, e, t) {
|
|
1456
|
+
const n = r.getTimezoneOffset();
|
|
1457
|
+
switch (e) {
|
|
1458
|
+
// Short
|
|
1459
|
+
case "O":
|
|
1460
|
+
case "OO":
|
|
1461
|
+
case "OOO":
|
|
1462
|
+
return "GMT" + ae(n, ":");
|
|
1463
|
+
// Long
|
|
1464
|
+
case "OOOO":
|
|
1465
|
+
default:
|
|
1466
|
+
return "GMT" + $(n, ":");
|
|
1467
|
+
}
|
|
1468
|
+
},
|
|
1469
|
+
// Timezone (specific non-location)
|
|
1470
|
+
z: function(r, e, t) {
|
|
1471
|
+
const n = r.getTimezoneOffset();
|
|
1472
|
+
switch (e) {
|
|
1473
|
+
// Short
|
|
1474
|
+
case "z":
|
|
1475
|
+
case "zz":
|
|
1476
|
+
case "zzz":
|
|
1477
|
+
return "GMT" + ae(n, ":");
|
|
1478
|
+
// Long
|
|
1479
|
+
case "zzzz":
|
|
1480
|
+
default:
|
|
1481
|
+
return "GMT" + $(n, ":");
|
|
1482
|
+
}
|
|
1483
|
+
},
|
|
1484
|
+
// Seconds timestamp
|
|
1485
|
+
t: function(r, e, t) {
|
|
1486
|
+
const n = Math.trunc(+r / 1e3);
|
|
1487
|
+
return d(n, e.length);
|
|
1488
|
+
},
|
|
1489
|
+
// Milliseconds timestamp
|
|
1490
|
+
T: function(r, e, t) {
|
|
1491
|
+
return d(+r, e.length);
|
|
1492
|
+
}
|
|
1493
|
+
};
|
|
1494
|
+
function ae(r, e = "") {
|
|
1495
|
+
const t = r > 0 ? "-" : "+", n = Math.abs(r), a = Math.trunc(n / 60), s = n % 60;
|
|
1496
|
+
return s === 0 ? t + String(a) : t + String(a) + e + d(s, 2);
|
|
1497
|
+
}
|
|
1498
|
+
function se(r, e) {
|
|
1499
|
+
return r % 60 === 0 ? (r > 0 ? "-" : "+") + d(Math.abs(r) / 60, 2) : $(r, e);
|
|
1500
|
+
}
|
|
1501
|
+
function $(r, e = "") {
|
|
1502
|
+
const t = r > 0 ? "-" : "+", n = Math.abs(r), a = d(Math.trunc(n / 60), 2), s = d(n % 60, 2);
|
|
1503
|
+
return t + a + e + s;
|
|
1504
|
+
}
|
|
1505
|
+
const oe = (r, e) => {
|
|
1506
|
+
switch (r) {
|
|
1507
|
+
case "P":
|
|
1508
|
+
return e.date({ width: "short" });
|
|
1509
|
+
case "PP":
|
|
1510
|
+
return e.date({ width: "medium" });
|
|
1511
|
+
case "PPP":
|
|
1512
|
+
return e.date({ width: "long" });
|
|
1513
|
+
case "PPPP":
|
|
1514
|
+
default:
|
|
1515
|
+
return e.date({ width: "full" });
|
|
1516
|
+
}
|
|
1517
|
+
}, Me = (r, e) => {
|
|
1518
|
+
switch (r) {
|
|
1519
|
+
case "p":
|
|
1520
|
+
return e.time({ width: "short" });
|
|
1521
|
+
case "pp":
|
|
1522
|
+
return e.time({ width: "medium" });
|
|
1523
|
+
case "ppp":
|
|
1524
|
+
return e.time({ width: "long" });
|
|
1525
|
+
case "pppp":
|
|
1526
|
+
default:
|
|
1527
|
+
return e.time({ width: "full" });
|
|
1528
|
+
}
|
|
1529
|
+
}, Ut = (r, e) => {
|
|
1530
|
+
const t = r.match(/(P+)(p+)?/) || [], n = t[1], a = t[2];
|
|
1531
|
+
if (!a)
|
|
1532
|
+
return oe(r, e);
|
|
1533
|
+
let s;
|
|
1534
|
+
switch (n) {
|
|
1535
|
+
case "P":
|
|
1536
|
+
s = e.dateTime({ width: "short" });
|
|
1537
|
+
break;
|
|
1538
|
+
case "PP":
|
|
1539
|
+
s = e.dateTime({ width: "medium" });
|
|
1540
|
+
break;
|
|
1541
|
+
case "PPP":
|
|
1542
|
+
s = e.dateTime({ width: "long" });
|
|
1543
|
+
break;
|
|
1544
|
+
case "PPPP":
|
|
1545
|
+
default:
|
|
1546
|
+
s = e.dateTime({ width: "full" });
|
|
1547
|
+
break;
|
|
1548
|
+
}
|
|
1549
|
+
return s.replace("{{date}}", oe(n, e)).replace("{{time}}", Me(a, e));
|
|
1550
|
+
}, z = {
|
|
1551
|
+
p: Me,
|
|
1552
|
+
P: Ut
|
|
1553
|
+
}, St = /^D+$/, en = /^Y+$/, tn = ["D", "DD", "YY", "YYYY"];
|
|
1554
|
+
function De(r) {
|
|
1555
|
+
return St.test(r);
|
|
1556
|
+
}
|
|
1557
|
+
function Pe(r) {
|
|
1558
|
+
return en.test(r);
|
|
1559
|
+
}
|
|
1560
|
+
function X(r, e, t) {
|
|
1561
|
+
const n = nn(r, e, t);
|
|
1562
|
+
if (console.warn(n), tn.includes(r)) throw new RangeError(n);
|
|
1563
|
+
}
|
|
1564
|
+
function nn(r, e, t) {
|
|
1565
|
+
const n = r[0] === "Y" ? "years" : "days of the month";
|
|
1566
|
+
return `Use \`${r.toLowerCase()}\` instead of \`${r}\` (in \`${e}\`) for formatting ${n} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
|
|
1567
|
+
}
|
|
1568
|
+
const rn = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g, an = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g, sn = /^'([^]*?)'?$/, on = /''/g, cn = /[a-zA-Z]/;
|
|
1569
|
+
function un(r, e, t) {
|
|
1570
|
+
const n = q(), a = n.locale ?? be, s = n.firstWeekContainsDate ?? n.locale?.options?.firstWeekContainsDate ?? 1, o = n.weekStartsOn ?? n.locale?.options?.weekStartsOn ?? 0, i = w(r, t?.in);
|
|
1571
|
+
if (!st(i))
|
|
1572
|
+
throw new RangeError("Invalid time value");
|
|
1573
|
+
let c = e.match(an).map((h) => {
|
|
1574
|
+
const m = h[0];
|
|
1575
|
+
if (m === "p" || m === "P") {
|
|
1576
|
+
const u = z[m];
|
|
1577
|
+
return u(h, a.formatLong);
|
|
1578
|
+
}
|
|
1579
|
+
return h;
|
|
1580
|
+
}).join("").match(rn).map((h) => {
|
|
1581
|
+
if (h === "''")
|
|
1582
|
+
return { isToken: !1, value: "'" };
|
|
1583
|
+
const m = h[0];
|
|
1584
|
+
if (m === "'")
|
|
1585
|
+
return { isToken: !1, value: dn(h) };
|
|
1586
|
+
if (re[m])
|
|
1587
|
+
return { isToken: !0, value: h };
|
|
1588
|
+
if (m.match(cn))
|
|
1589
|
+
throw new RangeError(
|
|
1590
|
+
"Format string contains an unescaped latin alphabet character `" + m + "`"
|
|
1591
|
+
);
|
|
1592
|
+
return { isToken: !1, value: h };
|
|
1593
|
+
});
|
|
1594
|
+
a.localize.preprocessor && (c = a.localize.preprocessor(i, c));
|
|
1595
|
+
const l = {
|
|
1596
|
+
firstWeekContainsDate: s,
|
|
1597
|
+
weekStartsOn: o,
|
|
1598
|
+
locale: a
|
|
1599
|
+
};
|
|
1600
|
+
return c.map((h) => {
|
|
1601
|
+
if (!h.isToken) return h.value;
|
|
1602
|
+
const m = h.value;
|
|
1603
|
+
(Pe(m) || De(m)) && X(m, e, String(r));
|
|
1604
|
+
const u = re[m[0]];
|
|
1605
|
+
return u(i, m, a.localize, l);
|
|
1606
|
+
}).join("");
|
|
1607
|
+
}
|
|
1608
|
+
function dn(r) {
|
|
1609
|
+
const e = r.match(sn);
|
|
1610
|
+
return e ? e[1].replace(on, "'") : r;
|
|
1611
|
+
}
|
|
1612
|
+
function ln(r, e) {
|
|
1613
|
+
const t = w(r, e?.in);
|
|
1614
|
+
if (isNaN(+t))
|
|
1615
|
+
throw new RangeError("Invalid time value");
|
|
1616
|
+
let n = "", a = "";
|
|
1617
|
+
const s = "-", o = ":";
|
|
1618
|
+
{
|
|
1619
|
+
const i = d(t.getDate(), 2), c = d(t.getMonth() + 1, 2);
|
|
1620
|
+
n = `${d(t.getFullYear(), 4)}${s}${c}${s}${i}`;
|
|
1621
|
+
}
|
|
1622
|
+
{
|
|
1623
|
+
const i = t.getTimezoneOffset();
|
|
1624
|
+
if (i !== 0) {
|
|
1625
|
+
const x = Math.abs(i), T = d(Math.trunc(x / 60), 2), W = d(x % 60, 2);
|
|
1626
|
+
a = `${i < 0 ? "+" : "-"}${T}:${W}`;
|
|
1627
|
+
} else
|
|
1628
|
+
a = "Z";
|
|
1629
|
+
const c = d(t.getHours(), 2), l = d(t.getMinutes(), 2), h = d(t.getSeconds(), 2), m = n === "" ? "" : "T", u = [c, l, h].join(o);
|
|
1630
|
+
n = `${n}${m}${u}${a}`;
|
|
1631
|
+
}
|
|
1632
|
+
return n;
|
|
1633
|
+
}
|
|
1634
|
+
function fn() {
|
|
1635
|
+
return Object.assign({}, q());
|
|
1636
|
+
}
|
|
1637
|
+
function hn(r, e) {
|
|
1638
|
+
const t = w(r, e?.in).getDay();
|
|
1639
|
+
return t === 0 ? 7 : t;
|
|
1640
|
+
}
|
|
1641
|
+
function mn(r, e) {
|
|
1642
|
+
return +w(r) > +w(e);
|
|
1643
|
+
}
|
|
1644
|
+
function wn(r, e) {
|
|
1645
|
+
return +w(r) < +w(e);
|
|
1646
|
+
}
|
|
1647
|
+
function gn(r, e) {
|
|
1648
|
+
const t = yn(e) ? new e(0) : P(e, 0);
|
|
1649
|
+
return t.setFullYear(r.getFullYear(), r.getMonth(), r.getDate()), t.setHours(
|
|
1650
|
+
r.getHours(),
|
|
1651
|
+
r.getMinutes(),
|
|
1652
|
+
r.getSeconds(),
|
|
1653
|
+
r.getMilliseconds()
|
|
1654
|
+
), t;
|
|
1655
|
+
}
|
|
1656
|
+
function yn(r) {
|
|
1657
|
+
return typeof r == "function" && r.prototype?.constructor === r;
|
|
1658
|
+
}
|
|
1659
|
+
const bn = 10;
|
|
1660
|
+
class Te {
|
|
1661
|
+
subPriority = 0;
|
|
1662
|
+
validate(e, t) {
|
|
1663
|
+
return !0;
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
class pn extends Te {
|
|
1667
|
+
constructor(e, t, n, a, s) {
|
|
1668
|
+
super(), this.value = e, this.validateValue = t, this.setValue = n, this.priority = a, s && (this.subPriority = s);
|
|
1669
|
+
}
|
|
1670
|
+
validate(e, t) {
|
|
1671
|
+
return this.validateValue(e, this.value, t);
|
|
1672
|
+
}
|
|
1673
|
+
set(e, t, n) {
|
|
1674
|
+
return this.setValue(e, t, this.value, n);
|
|
1675
|
+
}
|
|
1676
|
+
}
|
|
1677
|
+
class xn extends Te {
|
|
1678
|
+
priority = bn;
|
|
1679
|
+
subPriority = -1;
|
|
1680
|
+
constructor(e, t) {
|
|
1681
|
+
super(), this.context = e || ((n) => P(t, n));
|
|
1682
|
+
}
|
|
1683
|
+
set(e, t) {
|
|
1684
|
+
return t.timestampIsSet ? e : P(e, gn(e, this.context));
|
|
1685
|
+
}
|
|
1686
|
+
}
|
|
1687
|
+
class g {
|
|
1688
|
+
run(e, t, n, a) {
|
|
1689
|
+
const s = this.parse(e, t, n, a);
|
|
1690
|
+
return s ? {
|
|
1691
|
+
setter: new pn(
|
|
1692
|
+
s.value,
|
|
1693
|
+
this.validate,
|
|
1694
|
+
this.set,
|
|
1695
|
+
this.priority,
|
|
1696
|
+
this.subPriority
|
|
1697
|
+
),
|
|
1698
|
+
rest: s.rest
|
|
1699
|
+
} : null;
|
|
1700
|
+
}
|
|
1701
|
+
validate(e, t, n) {
|
|
1702
|
+
return !0;
|
|
1703
|
+
}
|
|
1704
|
+
}
|
|
1705
|
+
class Mn extends g {
|
|
1706
|
+
priority = 140;
|
|
1707
|
+
parse(e, t, n) {
|
|
1708
|
+
switch (t) {
|
|
1709
|
+
// AD, BC
|
|
1710
|
+
case "G":
|
|
1711
|
+
case "GG":
|
|
1712
|
+
case "GGG":
|
|
1713
|
+
return n.era(e, { width: "abbreviated" }) || n.era(e, { width: "narrow" });
|
|
1714
|
+
// A, B
|
|
1715
|
+
case "GGGGG":
|
|
1716
|
+
return n.era(e, { width: "narrow" });
|
|
1717
|
+
// Anno Domini, Before Christ
|
|
1718
|
+
case "GGGG":
|
|
1719
|
+
default:
|
|
1720
|
+
return n.era(e, { width: "wide" }) || n.era(e, { width: "abbreviated" }) || n.era(e, { width: "narrow" });
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1723
|
+
set(e, t, n) {
|
|
1724
|
+
return t.era = n, e.setFullYear(n, 0, 1), e.setHours(0, 0, 0, 0), e;
|
|
1725
|
+
}
|
|
1726
|
+
incompatibleTokens = ["R", "u", "t", "T"];
|
|
1727
|
+
}
|
|
1728
|
+
const M = {
|
|
1729
|
+
month: /^(1[0-2]|0?\d)/,
|
|
1730
|
+
// 0 to 12
|
|
1731
|
+
date: /^(3[0-1]|[0-2]?\d)/,
|
|
1732
|
+
// 0 to 31
|
|
1733
|
+
dayOfYear: /^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,
|
|
1734
|
+
// 0 to 366
|
|
1735
|
+
week: /^(5[0-3]|[0-4]?\d)/,
|
|
1736
|
+
// 0 to 53
|
|
1737
|
+
hour23h: /^(2[0-3]|[0-1]?\d)/,
|
|
1738
|
+
// 0 to 23
|
|
1739
|
+
hour24h: /^(2[0-4]|[0-1]?\d)/,
|
|
1740
|
+
// 0 to 24
|
|
1741
|
+
hour11h: /^(1[0-1]|0?\d)/,
|
|
1742
|
+
// 0 to 11
|
|
1743
|
+
hour12h: /^(1[0-2]|0?\d)/,
|
|
1744
|
+
// 0 to 12
|
|
1745
|
+
minute: /^[0-5]?\d/,
|
|
1746
|
+
// 0 to 59
|
|
1747
|
+
second: /^[0-5]?\d/,
|
|
1748
|
+
// 0 to 59
|
|
1749
|
+
singleDigit: /^\d/,
|
|
1750
|
+
// 0 to 9
|
|
1751
|
+
twoDigits: /^\d{1,2}/,
|
|
1752
|
+
// 0 to 99
|
|
1753
|
+
threeDigits: /^\d{1,3}/,
|
|
1754
|
+
// 0 to 999
|
|
1755
|
+
fourDigits: /^\d{1,4}/,
|
|
1756
|
+
// 0 to 9999
|
|
1757
|
+
anyDigitsSigned: /^-?\d+/,
|
|
1758
|
+
singleDigitSigned: /^-?\d/,
|
|
1759
|
+
// 0 to 9, -0 to -9
|
|
1760
|
+
twoDigitsSigned: /^-?\d{1,2}/,
|
|
1761
|
+
// 0 to 99, -0 to -99
|
|
1762
|
+
threeDigitsSigned: /^-?\d{1,3}/,
|
|
1763
|
+
// 0 to 999, -0 to -999
|
|
1764
|
+
fourDigitsSigned: /^-?\d{1,4}/
|
|
1765
|
+
// 0 to 9999, -0 to -9999
|
|
1766
|
+
}, O = {
|
|
1767
|
+
basicOptionalMinutes: /^([+-])(\d{2})(\d{2})?|Z/,
|
|
1768
|
+
basic: /^([+-])(\d{2})(\d{2})|Z/,
|
|
1769
|
+
basicOptionalSeconds: /^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,
|
|
1770
|
+
extended: /^([+-])(\d{2}):(\d{2})|Z/,
|
|
1771
|
+
extendedOptionalSeconds: /^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/
|
|
1772
|
+
};
|
|
1773
|
+
function D(r, e) {
|
|
1774
|
+
return r && {
|
|
1775
|
+
value: e(r.value),
|
|
1776
|
+
rest: r.rest
|
|
1777
|
+
};
|
|
1778
|
+
}
|
|
1779
|
+
function y(r, e) {
|
|
1780
|
+
const t = e.match(r);
|
|
1781
|
+
return t ? {
|
|
1782
|
+
value: parseInt(t[0], 10),
|
|
1783
|
+
rest: e.slice(t[0].length)
|
|
1784
|
+
} : null;
|
|
1785
|
+
}
|
|
1786
|
+
function Y(r, e) {
|
|
1787
|
+
const t = e.match(r);
|
|
1788
|
+
if (!t)
|
|
1789
|
+
return null;
|
|
1790
|
+
if (t[0] === "Z")
|
|
1791
|
+
return {
|
|
1792
|
+
value: 0,
|
|
1793
|
+
rest: e.slice(1)
|
|
1794
|
+
};
|
|
1795
|
+
const n = t[1] === "+" ? 1 : -1, a = t[2] ? parseInt(t[2], 10) : 0, s = t[3] ? parseInt(t[3], 10) : 0, o = t[5] ? parseInt(t[5], 10) : 0;
|
|
1796
|
+
return {
|
|
1797
|
+
value: n * (a * he + s * fe + o * tt),
|
|
1798
|
+
rest: e.slice(t[0].length)
|
|
1799
|
+
};
|
|
1800
|
+
}
|
|
1801
|
+
function ke(r) {
|
|
1802
|
+
return y(M.anyDigitsSigned, r);
|
|
1803
|
+
}
|
|
1804
|
+
function p(r, e) {
|
|
1805
|
+
switch (r) {
|
|
1806
|
+
case 1:
|
|
1807
|
+
return y(M.singleDigit, e);
|
|
1808
|
+
case 2:
|
|
1809
|
+
return y(M.twoDigits, e);
|
|
1810
|
+
case 3:
|
|
1811
|
+
return y(M.threeDigits, e);
|
|
1812
|
+
case 4:
|
|
1813
|
+
return y(M.fourDigits, e);
|
|
1814
|
+
default:
|
|
1815
|
+
return y(new RegExp("^\\d{1," + r + "}"), e);
|
|
1816
|
+
}
|
|
1817
|
+
}
|
|
1818
|
+
function R(r, e) {
|
|
1819
|
+
switch (r) {
|
|
1820
|
+
case 1:
|
|
1821
|
+
return y(M.singleDigitSigned, e);
|
|
1822
|
+
case 2:
|
|
1823
|
+
return y(M.twoDigitsSigned, e);
|
|
1824
|
+
case 3:
|
|
1825
|
+
return y(M.threeDigitsSigned, e);
|
|
1826
|
+
case 4:
|
|
1827
|
+
return y(M.fourDigitsSigned, e);
|
|
1828
|
+
default:
|
|
1829
|
+
return y(new RegExp("^-?\\d{1," + r + "}"), e);
|
|
1830
|
+
}
|
|
1831
|
+
}
|
|
1832
|
+
function Z(r) {
|
|
1833
|
+
switch (r) {
|
|
1834
|
+
case "morning":
|
|
1835
|
+
return 4;
|
|
1836
|
+
case "evening":
|
|
1837
|
+
return 17;
|
|
1838
|
+
case "pm":
|
|
1839
|
+
case "noon":
|
|
1840
|
+
case "afternoon":
|
|
1841
|
+
return 12;
|
|
1842
|
+
case "am":
|
|
1843
|
+
case "midnight":
|
|
1844
|
+
case "night":
|
|
1845
|
+
default:
|
|
1846
|
+
return 0;
|
|
1847
|
+
}
|
|
1848
|
+
}
|
|
1849
|
+
function Oe(r, e) {
|
|
1850
|
+
const t = e > 0, n = t ? e : 1 - e;
|
|
1851
|
+
let a;
|
|
1852
|
+
if (n <= 50)
|
|
1853
|
+
a = r || 100;
|
|
1854
|
+
else {
|
|
1855
|
+
const s = n + 50, o = Math.trunc(s / 100) * 100, i = r >= s % 100;
|
|
1856
|
+
a = r + o - (i ? 100 : 0);
|
|
1857
|
+
}
|
|
1858
|
+
return t ? a : 1 - a;
|
|
1859
|
+
}
|
|
1860
|
+
function Ye(r) {
|
|
1861
|
+
return r % 400 === 0 || r % 4 === 0 && r % 100 !== 0;
|
|
1862
|
+
}
|
|
1863
|
+
class Dn extends g {
|
|
1864
|
+
priority = 130;
|
|
1865
|
+
incompatibleTokens = ["Y", "R", "u", "w", "I", "i", "e", "c", "t", "T"];
|
|
1866
|
+
parse(e, t, n) {
|
|
1867
|
+
const a = (s) => ({
|
|
1868
|
+
year: s,
|
|
1869
|
+
isTwoDigitYear: t === "yy"
|
|
1870
|
+
});
|
|
1871
|
+
switch (t) {
|
|
1872
|
+
case "y":
|
|
1873
|
+
return D(p(4, e), a);
|
|
1874
|
+
case "yo":
|
|
1875
|
+
return D(
|
|
1876
|
+
n.ordinalNumber(e, {
|
|
1877
|
+
unit: "year"
|
|
1878
|
+
}),
|
|
1879
|
+
a
|
|
1880
|
+
);
|
|
1881
|
+
default:
|
|
1882
|
+
return D(p(t.length, e), a);
|
|
1883
|
+
}
|
|
1884
|
+
}
|
|
1885
|
+
validate(e, t) {
|
|
1886
|
+
return t.isTwoDigitYear || t.year > 0;
|
|
1887
|
+
}
|
|
1888
|
+
set(e, t, n) {
|
|
1889
|
+
const a = e.getFullYear();
|
|
1890
|
+
if (n.isTwoDigitYear) {
|
|
1891
|
+
const o = Oe(
|
|
1892
|
+
n.year,
|
|
1893
|
+
a
|
|
1894
|
+
);
|
|
1895
|
+
return e.setFullYear(o, 0, 1), e.setHours(0, 0, 0, 0), e;
|
|
1896
|
+
}
|
|
1897
|
+
const s = !("era" in t) || t.era === 1 ? n.year : 1 - n.year;
|
|
1898
|
+
return e.setFullYear(s, 0, 1), e.setHours(0, 0, 0, 0), e;
|
|
1899
|
+
}
|
|
1900
|
+
}
|
|
1901
|
+
class Pn extends g {
|
|
1902
|
+
priority = 130;
|
|
1903
|
+
parse(e, t, n) {
|
|
1904
|
+
const a = (s) => ({
|
|
1905
|
+
year: s,
|
|
1906
|
+
isTwoDigitYear: t === "YY"
|
|
1907
|
+
});
|
|
1908
|
+
switch (t) {
|
|
1909
|
+
case "Y":
|
|
1910
|
+
return D(p(4, e), a);
|
|
1911
|
+
case "Yo":
|
|
1912
|
+
return D(
|
|
1913
|
+
n.ordinalNumber(e, {
|
|
1914
|
+
unit: "year"
|
|
1915
|
+
}),
|
|
1916
|
+
a
|
|
1917
|
+
);
|
|
1918
|
+
default:
|
|
1919
|
+
return D(p(t.length, e), a);
|
|
1920
|
+
}
|
|
1921
|
+
}
|
|
1922
|
+
validate(e, t) {
|
|
1923
|
+
return t.isTwoDigitYear || t.year > 0;
|
|
1924
|
+
}
|
|
1925
|
+
set(e, t, n, a) {
|
|
1926
|
+
const s = V(e, a);
|
|
1927
|
+
if (n.isTwoDigitYear) {
|
|
1928
|
+
const i = Oe(
|
|
1929
|
+
n.year,
|
|
1930
|
+
s
|
|
1931
|
+
);
|
|
1932
|
+
return e.setFullYear(
|
|
1933
|
+
i,
|
|
1934
|
+
0,
|
|
1935
|
+
a.firstWeekContainsDate
|
|
1936
|
+
), e.setHours(0, 0, 0, 0), E(e, a);
|
|
1937
|
+
}
|
|
1938
|
+
const o = !("era" in t) || t.era === 1 ? n.year : 1 - n.year;
|
|
1939
|
+
return e.setFullYear(o, 0, a.firstWeekContainsDate), e.setHours(0, 0, 0, 0), E(e, a);
|
|
1940
|
+
}
|
|
1941
|
+
incompatibleTokens = [
|
|
1942
|
+
"y",
|
|
1943
|
+
"R",
|
|
1944
|
+
"u",
|
|
1945
|
+
"Q",
|
|
1946
|
+
"q",
|
|
1947
|
+
"M",
|
|
1948
|
+
"L",
|
|
1949
|
+
"I",
|
|
1950
|
+
"d",
|
|
1951
|
+
"D",
|
|
1952
|
+
"i",
|
|
1953
|
+
"t",
|
|
1954
|
+
"T"
|
|
1955
|
+
];
|
|
1956
|
+
}
|
|
1957
|
+
class Tn extends g {
|
|
1958
|
+
priority = 130;
|
|
1959
|
+
parse(e, t) {
|
|
1960
|
+
return R(t === "R" ? 4 : t.length, e);
|
|
1961
|
+
}
|
|
1962
|
+
set(e, t, n) {
|
|
1963
|
+
const a = P(e, 0);
|
|
1964
|
+
return a.setFullYear(n, 0, 4), a.setHours(0, 0, 0, 0), H(a);
|
|
1965
|
+
}
|
|
1966
|
+
incompatibleTokens = [
|
|
1967
|
+
"G",
|
|
1968
|
+
"y",
|
|
1969
|
+
"Y",
|
|
1970
|
+
"u",
|
|
1971
|
+
"Q",
|
|
1972
|
+
"q",
|
|
1973
|
+
"M",
|
|
1974
|
+
"L",
|
|
1975
|
+
"w",
|
|
1976
|
+
"d",
|
|
1977
|
+
"D",
|
|
1978
|
+
"e",
|
|
1979
|
+
"c",
|
|
1980
|
+
"t",
|
|
1981
|
+
"T"
|
|
1982
|
+
];
|
|
1983
|
+
}
|
|
1984
|
+
class kn extends g {
|
|
1985
|
+
priority = 130;
|
|
1986
|
+
parse(e, t) {
|
|
1987
|
+
return R(t === "u" ? 4 : t.length, e);
|
|
1988
|
+
}
|
|
1989
|
+
set(e, t, n) {
|
|
1990
|
+
return e.setFullYear(n, 0, 1), e.setHours(0, 0, 0, 0), e;
|
|
1991
|
+
}
|
|
1992
|
+
incompatibleTokens = ["G", "y", "Y", "R", "w", "I", "i", "e", "c", "t", "T"];
|
|
1993
|
+
}
|
|
1994
|
+
class On extends g {
|
|
1995
|
+
priority = 120;
|
|
1996
|
+
parse(e, t, n) {
|
|
1997
|
+
switch (t) {
|
|
1998
|
+
// 1, 2, 3, 4
|
|
1999
|
+
case "Q":
|
|
2000
|
+
case "QQ":
|
|
2001
|
+
return p(t.length, e);
|
|
2002
|
+
// 1st, 2nd, 3rd, 4th
|
|
2003
|
+
case "Qo":
|
|
2004
|
+
return n.ordinalNumber(e, { unit: "quarter" });
|
|
2005
|
+
// Q1, Q2, Q3, Q4
|
|
2006
|
+
case "QQQ":
|
|
2007
|
+
return n.quarter(e, {
|
|
2008
|
+
width: "abbreviated",
|
|
2009
|
+
context: "formatting"
|
|
2010
|
+
}) || n.quarter(e, {
|
|
2011
|
+
width: "narrow",
|
|
2012
|
+
context: "formatting"
|
|
2013
|
+
});
|
|
2014
|
+
// 1, 2, 3, 4 (narrow quarter; could be not numerical)
|
|
2015
|
+
case "QQQQQ":
|
|
2016
|
+
return n.quarter(e, {
|
|
2017
|
+
width: "narrow",
|
|
2018
|
+
context: "formatting"
|
|
2019
|
+
});
|
|
2020
|
+
// 1st quarter, 2nd quarter, ...
|
|
2021
|
+
case "QQQQ":
|
|
2022
|
+
default:
|
|
2023
|
+
return n.quarter(e, {
|
|
2024
|
+
width: "wide",
|
|
2025
|
+
context: "formatting"
|
|
2026
|
+
}) || n.quarter(e, {
|
|
2027
|
+
width: "abbreviated",
|
|
2028
|
+
context: "formatting"
|
|
2029
|
+
}) || n.quarter(e, {
|
|
2030
|
+
width: "narrow",
|
|
2031
|
+
context: "formatting"
|
|
2032
|
+
});
|
|
2033
|
+
}
|
|
2034
|
+
}
|
|
2035
|
+
validate(e, t) {
|
|
2036
|
+
return t >= 1 && t <= 4;
|
|
2037
|
+
}
|
|
2038
|
+
set(e, t, n) {
|
|
2039
|
+
return e.setMonth((n - 1) * 3, 1), e.setHours(0, 0, 0, 0), e;
|
|
2040
|
+
}
|
|
2041
|
+
incompatibleTokens = [
|
|
2042
|
+
"Y",
|
|
2043
|
+
"R",
|
|
2044
|
+
"q",
|
|
2045
|
+
"M",
|
|
2046
|
+
"L",
|
|
2047
|
+
"w",
|
|
2048
|
+
"I",
|
|
2049
|
+
"d",
|
|
2050
|
+
"D",
|
|
2051
|
+
"i",
|
|
2052
|
+
"e",
|
|
2053
|
+
"c",
|
|
2054
|
+
"t",
|
|
2055
|
+
"T"
|
|
2056
|
+
];
|
|
2057
|
+
}
|
|
2058
|
+
class Yn extends g {
|
|
2059
|
+
priority = 120;
|
|
2060
|
+
parse(e, t, n) {
|
|
2061
|
+
switch (t) {
|
|
2062
|
+
// 1, 2, 3, 4
|
|
2063
|
+
case "q":
|
|
2064
|
+
case "qq":
|
|
2065
|
+
return p(t.length, e);
|
|
2066
|
+
// 1st, 2nd, 3rd, 4th
|
|
2067
|
+
case "qo":
|
|
2068
|
+
return n.ordinalNumber(e, { unit: "quarter" });
|
|
2069
|
+
// Q1, Q2, Q3, Q4
|
|
2070
|
+
case "qqq":
|
|
2071
|
+
return n.quarter(e, {
|
|
2072
|
+
width: "abbreviated",
|
|
2073
|
+
context: "standalone"
|
|
2074
|
+
}) || n.quarter(e, {
|
|
2075
|
+
width: "narrow",
|
|
2076
|
+
context: "standalone"
|
|
2077
|
+
});
|
|
2078
|
+
// 1, 2, 3, 4 (narrow quarter; could be not numerical)
|
|
2079
|
+
case "qqqqq":
|
|
2080
|
+
return n.quarter(e, {
|
|
2081
|
+
width: "narrow",
|
|
2082
|
+
context: "standalone"
|
|
2083
|
+
});
|
|
2084
|
+
// 1st quarter, 2nd quarter, ...
|
|
2085
|
+
case "qqqq":
|
|
2086
|
+
default:
|
|
2087
|
+
return n.quarter(e, {
|
|
2088
|
+
width: "wide",
|
|
2089
|
+
context: "standalone"
|
|
2090
|
+
}) || n.quarter(e, {
|
|
2091
|
+
width: "abbreviated",
|
|
2092
|
+
context: "standalone"
|
|
2093
|
+
}) || n.quarter(e, {
|
|
2094
|
+
width: "narrow",
|
|
2095
|
+
context: "standalone"
|
|
2096
|
+
});
|
|
2097
|
+
}
|
|
2098
|
+
}
|
|
2099
|
+
validate(e, t) {
|
|
2100
|
+
return t >= 1 && t <= 4;
|
|
2101
|
+
}
|
|
2102
|
+
set(e, t, n) {
|
|
2103
|
+
return e.setMonth((n - 1) * 3, 1), e.setHours(0, 0, 0, 0), e;
|
|
2104
|
+
}
|
|
2105
|
+
incompatibleTokens = [
|
|
2106
|
+
"Y",
|
|
2107
|
+
"R",
|
|
2108
|
+
"Q",
|
|
2109
|
+
"M",
|
|
2110
|
+
"L",
|
|
2111
|
+
"w",
|
|
2112
|
+
"I",
|
|
2113
|
+
"d",
|
|
2114
|
+
"D",
|
|
2115
|
+
"i",
|
|
2116
|
+
"e",
|
|
2117
|
+
"c",
|
|
2118
|
+
"t",
|
|
2119
|
+
"T"
|
|
2120
|
+
];
|
|
2121
|
+
}
|
|
2122
|
+
class vn extends g {
|
|
2123
|
+
incompatibleTokens = [
|
|
2124
|
+
"Y",
|
|
2125
|
+
"R",
|
|
2126
|
+
"q",
|
|
2127
|
+
"Q",
|
|
2128
|
+
"L",
|
|
2129
|
+
"w",
|
|
2130
|
+
"I",
|
|
2131
|
+
"D",
|
|
2132
|
+
"i",
|
|
2133
|
+
"e",
|
|
2134
|
+
"c",
|
|
2135
|
+
"t",
|
|
2136
|
+
"T"
|
|
2137
|
+
];
|
|
2138
|
+
priority = 110;
|
|
2139
|
+
parse(e, t, n) {
|
|
2140
|
+
const a = (s) => s - 1;
|
|
2141
|
+
switch (t) {
|
|
2142
|
+
// 1, 2, ..., 12
|
|
2143
|
+
case "M":
|
|
2144
|
+
return D(
|
|
2145
|
+
y(M.month, e),
|
|
2146
|
+
a
|
|
2147
|
+
);
|
|
2148
|
+
// 01, 02, ..., 12
|
|
2149
|
+
case "MM":
|
|
2150
|
+
return D(p(2, e), a);
|
|
2151
|
+
// 1st, 2nd, ..., 12th
|
|
2152
|
+
case "Mo":
|
|
2153
|
+
return D(
|
|
2154
|
+
n.ordinalNumber(e, {
|
|
2155
|
+
unit: "month"
|
|
2156
|
+
}),
|
|
2157
|
+
a
|
|
2158
|
+
);
|
|
2159
|
+
// Jan, Feb, ..., Dec
|
|
2160
|
+
case "MMM":
|
|
2161
|
+
return n.month(e, {
|
|
2162
|
+
width: "abbreviated",
|
|
2163
|
+
context: "formatting"
|
|
2164
|
+
}) || n.month(e, { width: "narrow", context: "formatting" });
|
|
2165
|
+
// J, F, ..., D
|
|
2166
|
+
case "MMMMM":
|
|
2167
|
+
return n.month(e, {
|
|
2168
|
+
width: "narrow",
|
|
2169
|
+
context: "formatting"
|
|
2170
|
+
});
|
|
2171
|
+
// January, February, ..., December
|
|
2172
|
+
case "MMMM":
|
|
2173
|
+
default:
|
|
2174
|
+
return n.month(e, { width: "wide", context: "formatting" }) || n.month(e, {
|
|
2175
|
+
width: "abbreviated",
|
|
2176
|
+
context: "formatting"
|
|
2177
|
+
}) || n.month(e, { width: "narrow", context: "formatting" });
|
|
2178
|
+
}
|
|
2179
|
+
}
|
|
2180
|
+
validate(e, t) {
|
|
2181
|
+
return t >= 0 && t <= 11;
|
|
2182
|
+
}
|
|
2183
|
+
set(e, t, n) {
|
|
2184
|
+
return e.setMonth(n, 1), e.setHours(0, 0, 0, 0), e;
|
|
2185
|
+
}
|
|
2186
|
+
}
|
|
2187
|
+
class _n extends g {
|
|
2188
|
+
priority = 110;
|
|
2189
|
+
parse(e, t, n) {
|
|
2190
|
+
const a = (s) => s - 1;
|
|
2191
|
+
switch (t) {
|
|
2192
|
+
// 1, 2, ..., 12
|
|
2193
|
+
case "L":
|
|
2194
|
+
return D(
|
|
2195
|
+
y(M.month, e),
|
|
2196
|
+
a
|
|
2197
|
+
);
|
|
2198
|
+
// 01, 02, ..., 12
|
|
2199
|
+
case "LL":
|
|
2200
|
+
return D(p(2, e), a);
|
|
2201
|
+
// 1st, 2nd, ..., 12th
|
|
2202
|
+
case "Lo":
|
|
2203
|
+
return D(
|
|
2204
|
+
n.ordinalNumber(e, {
|
|
2205
|
+
unit: "month"
|
|
2206
|
+
}),
|
|
2207
|
+
a
|
|
2208
|
+
);
|
|
2209
|
+
// Jan, Feb, ..., Dec
|
|
2210
|
+
case "LLL":
|
|
2211
|
+
return n.month(e, {
|
|
2212
|
+
width: "abbreviated",
|
|
2213
|
+
context: "standalone"
|
|
2214
|
+
}) || n.month(e, { width: "narrow", context: "standalone" });
|
|
2215
|
+
// J, F, ..., D
|
|
2216
|
+
case "LLLLL":
|
|
2217
|
+
return n.month(e, {
|
|
2218
|
+
width: "narrow",
|
|
2219
|
+
context: "standalone"
|
|
2220
|
+
});
|
|
2221
|
+
// January, February, ..., December
|
|
2222
|
+
case "LLLL":
|
|
2223
|
+
default:
|
|
2224
|
+
return n.month(e, { width: "wide", context: "standalone" }) || n.month(e, {
|
|
2225
|
+
width: "abbreviated",
|
|
2226
|
+
context: "standalone"
|
|
2227
|
+
}) || n.month(e, { width: "narrow", context: "standalone" });
|
|
2228
|
+
}
|
|
2229
|
+
}
|
|
2230
|
+
validate(e, t) {
|
|
2231
|
+
return t >= 0 && t <= 11;
|
|
2232
|
+
}
|
|
2233
|
+
set(e, t, n) {
|
|
2234
|
+
return e.setMonth(n, 1), e.setHours(0, 0, 0, 0), e;
|
|
2235
|
+
}
|
|
2236
|
+
incompatibleTokens = [
|
|
2237
|
+
"Y",
|
|
2238
|
+
"R",
|
|
2239
|
+
"q",
|
|
2240
|
+
"Q",
|
|
2241
|
+
"M",
|
|
2242
|
+
"w",
|
|
2243
|
+
"I",
|
|
2244
|
+
"D",
|
|
2245
|
+
"i",
|
|
2246
|
+
"e",
|
|
2247
|
+
"c",
|
|
2248
|
+
"t",
|
|
2249
|
+
"T"
|
|
2250
|
+
];
|
|
2251
|
+
}
|
|
2252
|
+
function En(r, e, t) {
|
|
2253
|
+
const n = w(r, t?.in), a = xe(n, t) - e;
|
|
2254
|
+
return n.setDate(n.getDate() - a * 7), w(n, t?.in);
|
|
2255
|
+
}
|
|
2256
|
+
class Wn extends g {
|
|
2257
|
+
priority = 100;
|
|
2258
|
+
parse(e, t, n) {
|
|
2259
|
+
switch (t) {
|
|
2260
|
+
case "w":
|
|
2261
|
+
return y(M.week, e);
|
|
2262
|
+
case "wo":
|
|
2263
|
+
return n.ordinalNumber(e, { unit: "week" });
|
|
2264
|
+
default:
|
|
2265
|
+
return p(t.length, e);
|
|
2266
|
+
}
|
|
2267
|
+
}
|
|
2268
|
+
validate(e, t) {
|
|
2269
|
+
return t >= 1 && t <= 53;
|
|
2270
|
+
}
|
|
2271
|
+
set(e, t, n, a) {
|
|
2272
|
+
return E(En(e, n, a), a);
|
|
2273
|
+
}
|
|
2274
|
+
incompatibleTokens = [
|
|
2275
|
+
"y",
|
|
2276
|
+
"R",
|
|
2277
|
+
"u",
|
|
2278
|
+
"q",
|
|
2279
|
+
"Q",
|
|
2280
|
+
"M",
|
|
2281
|
+
"L",
|
|
2282
|
+
"I",
|
|
2283
|
+
"d",
|
|
2284
|
+
"D",
|
|
2285
|
+
"i",
|
|
2286
|
+
"t",
|
|
2287
|
+
"T"
|
|
2288
|
+
];
|
|
2289
|
+
}
|
|
2290
|
+
function $n(r, e, t) {
|
|
2291
|
+
const n = w(r, t?.in), a = pe(n, t) - e;
|
|
2292
|
+
return n.setDate(n.getDate() - a * 7), n;
|
|
2293
|
+
}
|
|
2294
|
+
class Nn extends g {
|
|
2295
|
+
priority = 100;
|
|
2296
|
+
parse(e, t, n) {
|
|
2297
|
+
switch (t) {
|
|
2298
|
+
case "I":
|
|
2299
|
+
return y(M.week, e);
|
|
2300
|
+
case "Io":
|
|
2301
|
+
return n.ordinalNumber(e, { unit: "week" });
|
|
2302
|
+
default:
|
|
2303
|
+
return p(t.length, e);
|
|
2304
|
+
}
|
|
2305
|
+
}
|
|
2306
|
+
validate(e, t) {
|
|
2307
|
+
return t >= 1 && t <= 53;
|
|
2308
|
+
}
|
|
2309
|
+
set(e, t, n) {
|
|
2310
|
+
return H($n(e, n));
|
|
2311
|
+
}
|
|
2312
|
+
incompatibleTokens = [
|
|
2313
|
+
"y",
|
|
2314
|
+
"Y",
|
|
2315
|
+
"u",
|
|
2316
|
+
"q",
|
|
2317
|
+
"Q",
|
|
2318
|
+
"M",
|
|
2319
|
+
"L",
|
|
2320
|
+
"w",
|
|
2321
|
+
"d",
|
|
2322
|
+
"D",
|
|
2323
|
+
"e",
|
|
2324
|
+
"c",
|
|
2325
|
+
"t",
|
|
2326
|
+
"T"
|
|
2327
|
+
];
|
|
2328
|
+
}
|
|
2329
|
+
const Fn = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], Hn = [
|
|
2330
|
+
31,
|
|
2331
|
+
29,
|
|
2332
|
+
31,
|
|
2333
|
+
30,
|
|
2334
|
+
31,
|
|
2335
|
+
30,
|
|
2336
|
+
31,
|
|
2337
|
+
31,
|
|
2338
|
+
30,
|
|
2339
|
+
31,
|
|
2340
|
+
30,
|
|
2341
|
+
31
|
|
2342
|
+
];
|
|
2343
|
+
class qn extends g {
|
|
2344
|
+
priority = 90;
|
|
2345
|
+
subPriority = 1;
|
|
2346
|
+
parse(e, t, n) {
|
|
2347
|
+
switch (t) {
|
|
2348
|
+
case "d":
|
|
2349
|
+
return y(M.date, e);
|
|
2350
|
+
case "do":
|
|
2351
|
+
return n.ordinalNumber(e, { unit: "date" });
|
|
2352
|
+
default:
|
|
2353
|
+
return p(t.length, e);
|
|
2354
|
+
}
|
|
2355
|
+
}
|
|
2356
|
+
validate(e, t) {
|
|
2357
|
+
const n = e.getFullYear(), a = Ye(n), s = e.getMonth();
|
|
2358
|
+
return a ? t >= 1 && t <= Hn[s] : t >= 1 && t <= Fn[s];
|
|
2359
|
+
}
|
|
2360
|
+
set(e, t, n) {
|
|
2361
|
+
return e.setDate(n), e.setHours(0, 0, 0, 0), e;
|
|
2362
|
+
}
|
|
2363
|
+
incompatibleTokens = [
|
|
2364
|
+
"Y",
|
|
2365
|
+
"R",
|
|
2366
|
+
"q",
|
|
2367
|
+
"Q",
|
|
2368
|
+
"w",
|
|
2369
|
+
"I",
|
|
2370
|
+
"D",
|
|
2371
|
+
"i",
|
|
2372
|
+
"e",
|
|
2373
|
+
"c",
|
|
2374
|
+
"t",
|
|
2375
|
+
"T"
|
|
2376
|
+
];
|
|
2377
|
+
}
|
|
2378
|
+
class In extends g {
|
|
2379
|
+
priority = 90;
|
|
2380
|
+
subpriority = 1;
|
|
2381
|
+
parse(e, t, n) {
|
|
2382
|
+
switch (t) {
|
|
2383
|
+
case "D":
|
|
2384
|
+
case "DD":
|
|
2385
|
+
return y(M.dayOfYear, e);
|
|
2386
|
+
case "Do":
|
|
2387
|
+
return n.ordinalNumber(e, { unit: "date" });
|
|
2388
|
+
default:
|
|
2389
|
+
return p(t.length, e);
|
|
2390
|
+
}
|
|
2391
|
+
}
|
|
2392
|
+
validate(e, t) {
|
|
2393
|
+
const n = e.getFullYear();
|
|
2394
|
+
return Ye(n) ? t >= 1 && t <= 366 : t >= 1 && t <= 365;
|
|
2395
|
+
}
|
|
2396
|
+
set(e, t, n) {
|
|
2397
|
+
return e.setMonth(0, n), e.setHours(0, 0, 0, 0), e;
|
|
2398
|
+
}
|
|
2399
|
+
incompatibleTokens = [
|
|
2400
|
+
"Y",
|
|
2401
|
+
"R",
|
|
2402
|
+
"q",
|
|
2403
|
+
"Q",
|
|
2404
|
+
"M",
|
|
2405
|
+
"L",
|
|
2406
|
+
"w",
|
|
2407
|
+
"I",
|
|
2408
|
+
"d",
|
|
2409
|
+
"E",
|
|
2410
|
+
"i",
|
|
2411
|
+
"e",
|
|
2412
|
+
"c",
|
|
2413
|
+
"t",
|
|
2414
|
+
"T"
|
|
2415
|
+
];
|
|
2416
|
+
}
|
|
2417
|
+
function K(r, e, t) {
|
|
2418
|
+
const n = q(), a = t?.weekStartsOn ?? t?.locale?.options?.weekStartsOn ?? n.weekStartsOn ?? n.locale?.options?.weekStartsOn ?? 0, s = w(r, t?.in), o = s.getDay(), c = (e % 7 + 7) % 7, l = 7 - a, h = e < 0 || e > 6 ? e - (o + l) % 7 : (c + l) % 7 - (o + l) % 7;
|
|
2419
|
+
return me(s, h, t);
|
|
2420
|
+
}
|
|
2421
|
+
class Ln extends g {
|
|
2422
|
+
priority = 90;
|
|
2423
|
+
parse(e, t, n) {
|
|
2424
|
+
switch (t) {
|
|
2425
|
+
// Tue
|
|
2426
|
+
case "E":
|
|
2427
|
+
case "EE":
|
|
2428
|
+
case "EEE":
|
|
2429
|
+
return n.day(e, {
|
|
2430
|
+
width: "abbreviated",
|
|
2431
|
+
context: "formatting"
|
|
2432
|
+
}) || n.day(e, { width: "short", context: "formatting" }) || n.day(e, { width: "narrow", context: "formatting" });
|
|
2433
|
+
// T
|
|
2434
|
+
case "EEEEE":
|
|
2435
|
+
return n.day(e, {
|
|
2436
|
+
width: "narrow",
|
|
2437
|
+
context: "formatting"
|
|
2438
|
+
});
|
|
2439
|
+
// Tu
|
|
2440
|
+
case "EEEEEE":
|
|
2441
|
+
return n.day(e, { width: "short", context: "formatting" }) || n.day(e, { width: "narrow", context: "formatting" });
|
|
2442
|
+
// Tuesday
|
|
2443
|
+
case "EEEE":
|
|
2444
|
+
default:
|
|
2445
|
+
return n.day(e, { width: "wide", context: "formatting" }) || n.day(e, {
|
|
2446
|
+
width: "abbreviated",
|
|
2447
|
+
context: "formatting"
|
|
2448
|
+
}) || n.day(e, { width: "short", context: "formatting" }) || n.day(e, { width: "narrow", context: "formatting" });
|
|
2449
|
+
}
|
|
2450
|
+
}
|
|
2451
|
+
validate(e, t) {
|
|
2452
|
+
return t >= 0 && t <= 6;
|
|
2453
|
+
}
|
|
2454
|
+
set(e, t, n, a) {
|
|
2455
|
+
return e = K(e, n, a), e.setHours(0, 0, 0, 0), e;
|
|
2456
|
+
}
|
|
2457
|
+
incompatibleTokens = ["D", "i", "e", "c", "t", "T"];
|
|
2458
|
+
}
|
|
2459
|
+
class An extends g {
|
|
2460
|
+
priority = 90;
|
|
2461
|
+
parse(e, t, n, a) {
|
|
2462
|
+
const s = (o) => {
|
|
2463
|
+
const i = Math.floor((o - 1) / 7) * 7;
|
|
2464
|
+
return (o + a.weekStartsOn + 6) % 7 + i;
|
|
2465
|
+
};
|
|
2466
|
+
switch (t) {
|
|
2467
|
+
// 3
|
|
2468
|
+
case "e":
|
|
2469
|
+
case "ee":
|
|
2470
|
+
return D(p(t.length, e), s);
|
|
2471
|
+
// 3rd
|
|
2472
|
+
case "eo":
|
|
2473
|
+
return D(
|
|
2474
|
+
n.ordinalNumber(e, {
|
|
2475
|
+
unit: "day"
|
|
2476
|
+
}),
|
|
2477
|
+
s
|
|
2478
|
+
);
|
|
2479
|
+
// Tue
|
|
2480
|
+
case "eee":
|
|
2481
|
+
return n.day(e, {
|
|
2482
|
+
width: "abbreviated",
|
|
2483
|
+
context: "formatting"
|
|
2484
|
+
}) || n.day(e, { width: "short", context: "formatting" }) || n.day(e, { width: "narrow", context: "formatting" });
|
|
2485
|
+
// T
|
|
2486
|
+
case "eeeee":
|
|
2487
|
+
return n.day(e, {
|
|
2488
|
+
width: "narrow",
|
|
2489
|
+
context: "formatting"
|
|
2490
|
+
});
|
|
2491
|
+
// Tu
|
|
2492
|
+
case "eeeeee":
|
|
2493
|
+
return n.day(e, { width: "short", context: "formatting" }) || n.day(e, { width: "narrow", context: "formatting" });
|
|
2494
|
+
// Tuesday
|
|
2495
|
+
case "eeee":
|
|
2496
|
+
default:
|
|
2497
|
+
return n.day(e, { width: "wide", context: "formatting" }) || n.day(e, {
|
|
2498
|
+
width: "abbreviated",
|
|
2499
|
+
context: "formatting"
|
|
2500
|
+
}) || n.day(e, { width: "short", context: "formatting" }) || n.day(e, { width: "narrow", context: "formatting" });
|
|
2501
|
+
}
|
|
2502
|
+
}
|
|
2503
|
+
validate(e, t) {
|
|
2504
|
+
return t >= 0 && t <= 6;
|
|
2505
|
+
}
|
|
2506
|
+
set(e, t, n, a) {
|
|
2507
|
+
return e = K(e, n, a), e.setHours(0, 0, 0, 0), e;
|
|
2508
|
+
}
|
|
2509
|
+
incompatibleTokens = [
|
|
2510
|
+
"y",
|
|
2511
|
+
"R",
|
|
2512
|
+
"u",
|
|
2513
|
+
"q",
|
|
2514
|
+
"Q",
|
|
2515
|
+
"M",
|
|
2516
|
+
"L",
|
|
2517
|
+
"I",
|
|
2518
|
+
"d",
|
|
2519
|
+
"D",
|
|
2520
|
+
"E",
|
|
2521
|
+
"i",
|
|
2522
|
+
"c",
|
|
2523
|
+
"t",
|
|
2524
|
+
"T"
|
|
2525
|
+
];
|
|
2526
|
+
}
|
|
2527
|
+
class Cn extends g {
|
|
2528
|
+
priority = 90;
|
|
2529
|
+
parse(e, t, n, a) {
|
|
2530
|
+
const s = (o) => {
|
|
2531
|
+
const i = Math.floor((o - 1) / 7) * 7;
|
|
2532
|
+
return (o + a.weekStartsOn + 6) % 7 + i;
|
|
2533
|
+
};
|
|
2534
|
+
switch (t) {
|
|
2535
|
+
// 3
|
|
2536
|
+
case "c":
|
|
2537
|
+
case "cc":
|
|
2538
|
+
return D(p(t.length, e), s);
|
|
2539
|
+
// 3rd
|
|
2540
|
+
case "co":
|
|
2541
|
+
return D(
|
|
2542
|
+
n.ordinalNumber(e, {
|
|
2543
|
+
unit: "day"
|
|
2544
|
+
}),
|
|
2545
|
+
s
|
|
2546
|
+
);
|
|
2547
|
+
// Tue
|
|
2548
|
+
case "ccc":
|
|
2549
|
+
return n.day(e, {
|
|
2550
|
+
width: "abbreviated",
|
|
2551
|
+
context: "standalone"
|
|
2552
|
+
}) || n.day(e, { width: "short", context: "standalone" }) || n.day(e, { width: "narrow", context: "standalone" });
|
|
2553
|
+
// T
|
|
2554
|
+
case "ccccc":
|
|
2555
|
+
return n.day(e, {
|
|
2556
|
+
width: "narrow",
|
|
2557
|
+
context: "standalone"
|
|
2558
|
+
});
|
|
2559
|
+
// Tu
|
|
2560
|
+
case "cccccc":
|
|
2561
|
+
return n.day(e, { width: "short", context: "standalone" }) || n.day(e, { width: "narrow", context: "standalone" });
|
|
2562
|
+
// Tuesday
|
|
2563
|
+
case "cccc":
|
|
2564
|
+
default:
|
|
2565
|
+
return n.day(e, { width: "wide", context: "standalone" }) || n.day(e, {
|
|
2566
|
+
width: "abbreviated",
|
|
2567
|
+
context: "standalone"
|
|
2568
|
+
}) || n.day(e, { width: "short", context: "standalone" }) || n.day(e, { width: "narrow", context: "standalone" });
|
|
2569
|
+
}
|
|
2570
|
+
}
|
|
2571
|
+
validate(e, t) {
|
|
2572
|
+
return t >= 0 && t <= 6;
|
|
2573
|
+
}
|
|
2574
|
+
set(e, t, n, a) {
|
|
2575
|
+
return e = K(e, n, a), e.setHours(0, 0, 0, 0), e;
|
|
2576
|
+
}
|
|
2577
|
+
incompatibleTokens = [
|
|
2578
|
+
"y",
|
|
2579
|
+
"R",
|
|
2580
|
+
"u",
|
|
2581
|
+
"q",
|
|
2582
|
+
"Q",
|
|
2583
|
+
"M",
|
|
2584
|
+
"L",
|
|
2585
|
+
"I",
|
|
2586
|
+
"d",
|
|
2587
|
+
"D",
|
|
2588
|
+
"E",
|
|
2589
|
+
"i",
|
|
2590
|
+
"e",
|
|
2591
|
+
"t",
|
|
2592
|
+
"T"
|
|
2593
|
+
];
|
|
2594
|
+
}
|
|
2595
|
+
function Rn(r, e, t) {
|
|
2596
|
+
const n = w(r, t?.in), a = hn(n, t), s = e - a;
|
|
2597
|
+
return me(n, s, t);
|
|
2598
|
+
}
|
|
2599
|
+
class Qn extends g {
|
|
2600
|
+
priority = 90;
|
|
2601
|
+
parse(e, t, n) {
|
|
2602
|
+
const a = (s) => s === 0 ? 7 : s;
|
|
2603
|
+
switch (t) {
|
|
2604
|
+
// 2
|
|
2605
|
+
case "i":
|
|
2606
|
+
case "ii":
|
|
2607
|
+
return p(t.length, e);
|
|
2608
|
+
// 2nd
|
|
2609
|
+
case "io":
|
|
2610
|
+
return n.ordinalNumber(e, { unit: "day" });
|
|
2611
|
+
// Tue
|
|
2612
|
+
case "iii":
|
|
2613
|
+
return D(
|
|
2614
|
+
n.day(e, {
|
|
2615
|
+
width: "abbreviated",
|
|
2616
|
+
context: "formatting"
|
|
2617
|
+
}) || n.day(e, {
|
|
2618
|
+
width: "short",
|
|
2619
|
+
context: "formatting"
|
|
2620
|
+
}) || n.day(e, {
|
|
2621
|
+
width: "narrow",
|
|
2622
|
+
context: "formatting"
|
|
2623
|
+
}),
|
|
2624
|
+
a
|
|
2625
|
+
);
|
|
2626
|
+
// T
|
|
2627
|
+
case "iiiii":
|
|
2628
|
+
return D(
|
|
2629
|
+
n.day(e, {
|
|
2630
|
+
width: "narrow",
|
|
2631
|
+
context: "formatting"
|
|
2632
|
+
}),
|
|
2633
|
+
a
|
|
2634
|
+
);
|
|
2635
|
+
// Tu
|
|
2636
|
+
case "iiiiii":
|
|
2637
|
+
return D(
|
|
2638
|
+
n.day(e, {
|
|
2639
|
+
width: "short",
|
|
2640
|
+
context: "formatting"
|
|
2641
|
+
}) || n.day(e, {
|
|
2642
|
+
width: "narrow",
|
|
2643
|
+
context: "formatting"
|
|
2644
|
+
}),
|
|
2645
|
+
a
|
|
2646
|
+
);
|
|
2647
|
+
// Tuesday
|
|
2648
|
+
case "iiii":
|
|
2649
|
+
default:
|
|
2650
|
+
return D(
|
|
2651
|
+
n.day(e, {
|
|
2652
|
+
width: "wide",
|
|
2653
|
+
context: "formatting"
|
|
2654
|
+
}) || n.day(e, {
|
|
2655
|
+
width: "abbreviated",
|
|
2656
|
+
context: "formatting"
|
|
2657
|
+
}) || n.day(e, {
|
|
2658
|
+
width: "short",
|
|
2659
|
+
context: "formatting"
|
|
2660
|
+
}) || n.day(e, {
|
|
2661
|
+
width: "narrow",
|
|
2662
|
+
context: "formatting"
|
|
2663
|
+
}),
|
|
2664
|
+
a
|
|
2665
|
+
);
|
|
2666
|
+
}
|
|
2667
|
+
}
|
|
2668
|
+
validate(e, t) {
|
|
2669
|
+
return t >= 1 && t <= 7;
|
|
2670
|
+
}
|
|
2671
|
+
set(e, t, n) {
|
|
2672
|
+
return e = Rn(e, n), e.setHours(0, 0, 0, 0), e;
|
|
2673
|
+
}
|
|
2674
|
+
incompatibleTokens = [
|
|
2675
|
+
"y",
|
|
2676
|
+
"Y",
|
|
2677
|
+
"u",
|
|
2678
|
+
"q",
|
|
2679
|
+
"Q",
|
|
2680
|
+
"M",
|
|
2681
|
+
"L",
|
|
2682
|
+
"w",
|
|
2683
|
+
"d",
|
|
2684
|
+
"D",
|
|
2685
|
+
"E",
|
|
2686
|
+
"e",
|
|
2687
|
+
"c",
|
|
2688
|
+
"t",
|
|
2689
|
+
"T"
|
|
2690
|
+
];
|
|
2691
|
+
}
|
|
2692
|
+
class Bn extends g {
|
|
2693
|
+
priority = 80;
|
|
2694
|
+
parse(e, t, n) {
|
|
2695
|
+
switch (t) {
|
|
2696
|
+
case "a":
|
|
2697
|
+
case "aa":
|
|
2698
|
+
case "aaa":
|
|
2699
|
+
return n.dayPeriod(e, {
|
|
2700
|
+
width: "abbreviated",
|
|
2701
|
+
context: "formatting"
|
|
2702
|
+
}) || n.dayPeriod(e, {
|
|
2703
|
+
width: "narrow",
|
|
2704
|
+
context: "formatting"
|
|
2705
|
+
});
|
|
2706
|
+
case "aaaaa":
|
|
2707
|
+
return n.dayPeriod(e, {
|
|
2708
|
+
width: "narrow",
|
|
2709
|
+
context: "formatting"
|
|
2710
|
+
});
|
|
2711
|
+
case "aaaa":
|
|
2712
|
+
default:
|
|
2713
|
+
return n.dayPeriod(e, {
|
|
2714
|
+
width: "wide",
|
|
2715
|
+
context: "formatting"
|
|
2716
|
+
}) || n.dayPeriod(e, {
|
|
2717
|
+
width: "abbreviated",
|
|
2718
|
+
context: "formatting"
|
|
2719
|
+
}) || n.dayPeriod(e, {
|
|
2720
|
+
width: "narrow",
|
|
2721
|
+
context: "formatting"
|
|
2722
|
+
});
|
|
2723
|
+
}
|
|
2724
|
+
}
|
|
2725
|
+
set(e, t, n) {
|
|
2726
|
+
return e.setHours(Z(n), 0, 0, 0), e;
|
|
2727
|
+
}
|
|
2728
|
+
incompatibleTokens = ["b", "B", "H", "k", "t", "T"];
|
|
2729
|
+
}
|
|
2730
|
+
class zn extends g {
|
|
2731
|
+
priority = 80;
|
|
2732
|
+
parse(e, t, n) {
|
|
2733
|
+
switch (t) {
|
|
2734
|
+
case "b":
|
|
2735
|
+
case "bb":
|
|
2736
|
+
case "bbb":
|
|
2737
|
+
return n.dayPeriod(e, {
|
|
2738
|
+
width: "abbreviated",
|
|
2739
|
+
context: "formatting"
|
|
2740
|
+
}) || n.dayPeriod(e, {
|
|
2741
|
+
width: "narrow",
|
|
2742
|
+
context: "formatting"
|
|
2743
|
+
});
|
|
2744
|
+
case "bbbbb":
|
|
2745
|
+
return n.dayPeriod(e, {
|
|
2746
|
+
width: "narrow",
|
|
2747
|
+
context: "formatting"
|
|
2748
|
+
});
|
|
2749
|
+
case "bbbb":
|
|
2750
|
+
default:
|
|
2751
|
+
return n.dayPeriod(e, {
|
|
2752
|
+
width: "wide",
|
|
2753
|
+
context: "formatting"
|
|
2754
|
+
}) || n.dayPeriod(e, {
|
|
2755
|
+
width: "abbreviated",
|
|
2756
|
+
context: "formatting"
|
|
2757
|
+
}) || n.dayPeriod(e, {
|
|
2758
|
+
width: "narrow",
|
|
2759
|
+
context: "formatting"
|
|
2760
|
+
});
|
|
2761
|
+
}
|
|
2762
|
+
}
|
|
2763
|
+
set(e, t, n) {
|
|
2764
|
+
return e.setHours(Z(n), 0, 0, 0), e;
|
|
2765
|
+
}
|
|
2766
|
+
incompatibleTokens = ["a", "B", "H", "k", "t", "T"];
|
|
2767
|
+
}
|
|
2768
|
+
class Xn extends g {
|
|
2769
|
+
priority = 80;
|
|
2770
|
+
parse(e, t, n) {
|
|
2771
|
+
switch (t) {
|
|
2772
|
+
case "B":
|
|
2773
|
+
case "BB":
|
|
2774
|
+
case "BBB":
|
|
2775
|
+
return n.dayPeriod(e, {
|
|
2776
|
+
width: "abbreviated",
|
|
2777
|
+
context: "formatting"
|
|
2778
|
+
}) || n.dayPeriod(e, {
|
|
2779
|
+
width: "narrow",
|
|
2780
|
+
context: "formatting"
|
|
2781
|
+
});
|
|
2782
|
+
case "BBBBB":
|
|
2783
|
+
return n.dayPeriod(e, {
|
|
2784
|
+
width: "narrow",
|
|
2785
|
+
context: "formatting"
|
|
2786
|
+
});
|
|
2787
|
+
case "BBBB":
|
|
2788
|
+
default:
|
|
2789
|
+
return n.dayPeriod(e, {
|
|
2790
|
+
width: "wide",
|
|
2791
|
+
context: "formatting"
|
|
2792
|
+
}) || n.dayPeriod(e, {
|
|
2793
|
+
width: "abbreviated",
|
|
2794
|
+
context: "formatting"
|
|
2795
|
+
}) || n.dayPeriod(e, {
|
|
2796
|
+
width: "narrow",
|
|
2797
|
+
context: "formatting"
|
|
2798
|
+
});
|
|
2799
|
+
}
|
|
2800
|
+
}
|
|
2801
|
+
set(e, t, n) {
|
|
2802
|
+
return e.setHours(Z(n), 0, 0, 0), e;
|
|
2803
|
+
}
|
|
2804
|
+
incompatibleTokens = ["a", "b", "t", "T"];
|
|
2805
|
+
}
|
|
2806
|
+
class jn extends g {
|
|
2807
|
+
priority = 70;
|
|
2808
|
+
parse(e, t, n) {
|
|
2809
|
+
switch (t) {
|
|
2810
|
+
case "h":
|
|
2811
|
+
return y(M.hour12h, e);
|
|
2812
|
+
case "ho":
|
|
2813
|
+
return n.ordinalNumber(e, { unit: "hour" });
|
|
2814
|
+
default:
|
|
2815
|
+
return p(t.length, e);
|
|
2816
|
+
}
|
|
2817
|
+
}
|
|
2818
|
+
validate(e, t) {
|
|
2819
|
+
return t >= 1 && t <= 12;
|
|
2820
|
+
}
|
|
2821
|
+
set(e, t, n) {
|
|
2822
|
+
const a = e.getHours() >= 12;
|
|
2823
|
+
return a && n < 12 ? e.setHours(n + 12, 0, 0, 0) : !a && n === 12 ? e.setHours(0, 0, 0, 0) : e.setHours(n, 0, 0, 0), e;
|
|
2824
|
+
}
|
|
2825
|
+
incompatibleTokens = ["H", "K", "k", "t", "T"];
|
|
2826
|
+
}
|
|
2827
|
+
class Gn extends g {
|
|
2828
|
+
priority = 70;
|
|
2829
|
+
parse(e, t, n) {
|
|
2830
|
+
switch (t) {
|
|
2831
|
+
case "H":
|
|
2832
|
+
return y(M.hour23h, e);
|
|
2833
|
+
case "Ho":
|
|
2834
|
+
return n.ordinalNumber(e, { unit: "hour" });
|
|
2835
|
+
default:
|
|
2836
|
+
return p(t.length, e);
|
|
2837
|
+
}
|
|
2838
|
+
}
|
|
2839
|
+
validate(e, t) {
|
|
2840
|
+
return t >= 0 && t <= 23;
|
|
2841
|
+
}
|
|
2842
|
+
set(e, t, n) {
|
|
2843
|
+
return e.setHours(n, 0, 0, 0), e;
|
|
2844
|
+
}
|
|
2845
|
+
incompatibleTokens = ["a", "b", "h", "K", "k", "t", "T"];
|
|
2846
|
+
}
|
|
2847
|
+
class Vn extends g {
|
|
2848
|
+
priority = 70;
|
|
2849
|
+
parse(e, t, n) {
|
|
2850
|
+
switch (t) {
|
|
2851
|
+
case "K":
|
|
2852
|
+
return y(M.hour11h, e);
|
|
2853
|
+
case "Ko":
|
|
2854
|
+
return n.ordinalNumber(e, { unit: "hour" });
|
|
2855
|
+
default:
|
|
2856
|
+
return p(t.length, e);
|
|
2857
|
+
}
|
|
2858
|
+
}
|
|
2859
|
+
validate(e, t) {
|
|
2860
|
+
return t >= 0 && t <= 11;
|
|
2861
|
+
}
|
|
2862
|
+
set(e, t, n) {
|
|
2863
|
+
return e.getHours() >= 12 && n < 12 ? e.setHours(n + 12, 0, 0, 0) : e.setHours(n, 0, 0, 0), e;
|
|
2864
|
+
}
|
|
2865
|
+
incompatibleTokens = ["h", "H", "k", "t", "T"];
|
|
2866
|
+
}
|
|
2867
|
+
class Zn extends g {
|
|
2868
|
+
priority = 70;
|
|
2869
|
+
parse(e, t, n) {
|
|
2870
|
+
switch (t) {
|
|
2871
|
+
case "k":
|
|
2872
|
+
return y(M.hour24h, e);
|
|
2873
|
+
case "ko":
|
|
2874
|
+
return n.ordinalNumber(e, { unit: "hour" });
|
|
2875
|
+
default:
|
|
2876
|
+
return p(t.length, e);
|
|
2877
|
+
}
|
|
2878
|
+
}
|
|
2879
|
+
validate(e, t) {
|
|
2880
|
+
return t >= 1 && t <= 24;
|
|
2881
|
+
}
|
|
2882
|
+
set(e, t, n) {
|
|
2883
|
+
const a = n <= 24 ? n % 24 : n;
|
|
2884
|
+
return e.setHours(a, 0, 0, 0), e;
|
|
2885
|
+
}
|
|
2886
|
+
incompatibleTokens = ["a", "b", "h", "H", "K", "t", "T"];
|
|
2887
|
+
}
|
|
2888
|
+
class Kn extends g {
|
|
2889
|
+
priority = 60;
|
|
2890
|
+
parse(e, t, n) {
|
|
2891
|
+
switch (t) {
|
|
2892
|
+
case "m":
|
|
2893
|
+
return y(M.minute, e);
|
|
2894
|
+
case "mo":
|
|
2895
|
+
return n.ordinalNumber(e, { unit: "minute" });
|
|
2896
|
+
default:
|
|
2897
|
+
return p(t.length, e);
|
|
2898
|
+
}
|
|
2899
|
+
}
|
|
2900
|
+
validate(e, t) {
|
|
2901
|
+
return t >= 0 && t <= 59;
|
|
2902
|
+
}
|
|
2903
|
+
set(e, t, n) {
|
|
2904
|
+
return e.setMinutes(n, 0, 0), e;
|
|
2905
|
+
}
|
|
2906
|
+
incompatibleTokens = ["t", "T"];
|
|
2907
|
+
}
|
|
2908
|
+
class Jn extends g {
|
|
2909
|
+
priority = 50;
|
|
2910
|
+
parse(e, t, n) {
|
|
2911
|
+
switch (t) {
|
|
2912
|
+
case "s":
|
|
2913
|
+
return y(M.second, e);
|
|
2914
|
+
case "so":
|
|
2915
|
+
return n.ordinalNumber(e, { unit: "second" });
|
|
2916
|
+
default:
|
|
2917
|
+
return p(t.length, e);
|
|
2918
|
+
}
|
|
2919
|
+
}
|
|
2920
|
+
validate(e, t) {
|
|
2921
|
+
return t >= 0 && t <= 59;
|
|
2922
|
+
}
|
|
2923
|
+
set(e, t, n) {
|
|
2924
|
+
return e.setSeconds(n, 0), e;
|
|
2925
|
+
}
|
|
2926
|
+
incompatibleTokens = ["t", "T"];
|
|
2927
|
+
}
|
|
2928
|
+
class Un extends g {
|
|
2929
|
+
priority = 30;
|
|
2930
|
+
parse(e, t) {
|
|
2931
|
+
const n = (a) => Math.trunc(a * Math.pow(10, -t.length + 3));
|
|
2932
|
+
return D(p(t.length, e), n);
|
|
2933
|
+
}
|
|
2934
|
+
set(e, t, n) {
|
|
2935
|
+
return e.setMilliseconds(n), e;
|
|
2936
|
+
}
|
|
2937
|
+
incompatibleTokens = ["t", "T"];
|
|
2938
|
+
}
|
|
2939
|
+
class Sn extends g {
|
|
2940
|
+
priority = 10;
|
|
2941
|
+
parse(e, t) {
|
|
2942
|
+
switch (t) {
|
|
2943
|
+
case "X":
|
|
2944
|
+
return Y(
|
|
2945
|
+
O.basicOptionalMinutes,
|
|
2946
|
+
e
|
|
2947
|
+
);
|
|
2948
|
+
case "XX":
|
|
2949
|
+
return Y(O.basic, e);
|
|
2950
|
+
case "XXXX":
|
|
2951
|
+
return Y(
|
|
2952
|
+
O.basicOptionalSeconds,
|
|
2953
|
+
e
|
|
2954
|
+
);
|
|
2955
|
+
case "XXXXX":
|
|
2956
|
+
return Y(
|
|
2957
|
+
O.extendedOptionalSeconds,
|
|
2958
|
+
e
|
|
2959
|
+
);
|
|
2960
|
+
case "XXX":
|
|
2961
|
+
default:
|
|
2962
|
+
return Y(O.extended, e);
|
|
2963
|
+
}
|
|
2964
|
+
}
|
|
2965
|
+
set(e, t, n) {
|
|
2966
|
+
return t.timestampIsSet ? e : P(
|
|
2967
|
+
e,
|
|
2968
|
+
e.getTime() - C(e) - n
|
|
2969
|
+
);
|
|
2970
|
+
}
|
|
2971
|
+
incompatibleTokens = ["t", "T", "x"];
|
|
2972
|
+
}
|
|
2973
|
+
class er extends g {
|
|
2974
|
+
priority = 10;
|
|
2975
|
+
parse(e, t) {
|
|
2976
|
+
switch (t) {
|
|
2977
|
+
case "x":
|
|
2978
|
+
return Y(
|
|
2979
|
+
O.basicOptionalMinutes,
|
|
2980
|
+
e
|
|
2981
|
+
);
|
|
2982
|
+
case "xx":
|
|
2983
|
+
return Y(O.basic, e);
|
|
2984
|
+
case "xxxx":
|
|
2985
|
+
return Y(
|
|
2986
|
+
O.basicOptionalSeconds,
|
|
2987
|
+
e
|
|
2988
|
+
);
|
|
2989
|
+
case "xxxxx":
|
|
2990
|
+
return Y(
|
|
2991
|
+
O.extendedOptionalSeconds,
|
|
2992
|
+
e
|
|
2993
|
+
);
|
|
2994
|
+
case "xxx":
|
|
2995
|
+
default:
|
|
2996
|
+
return Y(O.extended, e);
|
|
2997
|
+
}
|
|
2998
|
+
}
|
|
2999
|
+
set(e, t, n) {
|
|
3000
|
+
return t.timestampIsSet ? e : P(
|
|
3001
|
+
e,
|
|
3002
|
+
e.getTime() - C(e) - n
|
|
3003
|
+
);
|
|
3004
|
+
}
|
|
3005
|
+
incompatibleTokens = ["t", "T", "X"];
|
|
3006
|
+
}
|
|
3007
|
+
class tr extends g {
|
|
3008
|
+
priority = 40;
|
|
3009
|
+
parse(e) {
|
|
3010
|
+
return ke(e);
|
|
3011
|
+
}
|
|
3012
|
+
set(e, t, n) {
|
|
3013
|
+
return [P(e, n * 1e3), { timestampIsSet: !0 }];
|
|
3014
|
+
}
|
|
3015
|
+
incompatibleTokens = "*";
|
|
3016
|
+
}
|
|
3017
|
+
class nr extends g {
|
|
3018
|
+
priority = 20;
|
|
3019
|
+
parse(e) {
|
|
3020
|
+
return ke(e);
|
|
3021
|
+
}
|
|
3022
|
+
set(e, t, n) {
|
|
3023
|
+
return [P(e, n), { timestampIsSet: !0 }];
|
|
3024
|
+
}
|
|
3025
|
+
incompatibleTokens = "*";
|
|
3026
|
+
}
|
|
3027
|
+
const rr = {
|
|
3028
|
+
G: new Mn(),
|
|
3029
|
+
y: new Dn(),
|
|
3030
|
+
Y: new Pn(),
|
|
3031
|
+
R: new Tn(),
|
|
3032
|
+
u: new kn(),
|
|
3033
|
+
Q: new On(),
|
|
3034
|
+
q: new Yn(),
|
|
3035
|
+
M: new vn(),
|
|
3036
|
+
L: new _n(),
|
|
3037
|
+
w: new Wn(),
|
|
3038
|
+
I: new Nn(),
|
|
3039
|
+
d: new qn(),
|
|
3040
|
+
D: new In(),
|
|
3041
|
+
E: new Ln(),
|
|
3042
|
+
e: new An(),
|
|
3043
|
+
c: new Cn(),
|
|
3044
|
+
i: new Qn(),
|
|
3045
|
+
a: new Bn(),
|
|
3046
|
+
b: new zn(),
|
|
3047
|
+
B: new Xn(),
|
|
3048
|
+
h: new jn(),
|
|
3049
|
+
H: new Gn(),
|
|
3050
|
+
K: new Vn(),
|
|
3051
|
+
k: new Zn(),
|
|
3052
|
+
m: new Kn(),
|
|
3053
|
+
s: new Jn(),
|
|
3054
|
+
S: new Un(),
|
|
3055
|
+
X: new Sn(),
|
|
3056
|
+
x: new er(),
|
|
3057
|
+
t: new tr(),
|
|
3058
|
+
T: new nr()
|
|
3059
|
+
}, ar = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g, sr = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g, or = /^'([^]*?)'?$/, ir = /''/g, cr = /\S/, ur = /[a-zA-Z]/;
|
|
3060
|
+
function dr(r, e, t, n) {
|
|
3061
|
+
const a = () => P(t, NaN), s = fn(), o = s.locale ?? be, i = s.firstWeekContainsDate ?? s.locale?.options?.firstWeekContainsDate ?? 1, c = s.weekStartsOn ?? s.locale?.options?.weekStartsOn ?? 0;
|
|
3062
|
+
if (!e)
|
|
3063
|
+
return r ? a() : w(t, n?.in);
|
|
3064
|
+
const l = {
|
|
3065
|
+
firstWeekContainsDate: i,
|
|
3066
|
+
weekStartsOn: c,
|
|
3067
|
+
locale: o
|
|
3068
|
+
}, h = [new xn(n?.in, t)], m = e.match(sr).map((f) => {
|
|
3069
|
+
const b = f[0];
|
|
3070
|
+
if (b in z) {
|
|
3071
|
+
const k = z[b];
|
|
3072
|
+
return k(f, o.formatLong);
|
|
3073
|
+
}
|
|
3074
|
+
return f;
|
|
3075
|
+
}).join("").match(ar), u = [];
|
|
3076
|
+
for (let f of m) {
|
|
3077
|
+
Pe(f) && X(f, e, r), De(f) && X(f, e, r);
|
|
3078
|
+
const b = f[0], k = rr[b];
|
|
3079
|
+
if (k) {
|
|
3080
|
+
const { incompatibleTokens: J } = k;
|
|
3081
|
+
if (Array.isArray(J)) {
|
|
3082
|
+
const U = u.find(
|
|
3083
|
+
(S) => J.includes(S.token) || S.token === b
|
|
3084
|
+
);
|
|
3085
|
+
if (U)
|
|
3086
|
+
throw new RangeError(
|
|
3087
|
+
`The format string mustn't contain \`${U.fullToken}\` and \`${f}\` at the same time`
|
|
3088
|
+
);
|
|
3089
|
+
} else if (k.incompatibleTokens === "*" && u.length > 0)
|
|
3090
|
+
throw new RangeError(
|
|
3091
|
+
`The format string mustn't contain \`${f}\` and any other token at the same time`
|
|
3092
|
+
);
|
|
3093
|
+
u.push({ token: b, fullToken: f });
|
|
3094
|
+
const Q = k.run(
|
|
3095
|
+
r,
|
|
3096
|
+
f,
|
|
3097
|
+
o.match,
|
|
3098
|
+
l
|
|
3099
|
+
);
|
|
3100
|
+
if (!Q)
|
|
3101
|
+
return a();
|
|
3102
|
+
h.push(Q.setter), r = Q.rest;
|
|
3103
|
+
} else {
|
|
3104
|
+
if (b.match(ur))
|
|
3105
|
+
throw new RangeError(
|
|
3106
|
+
"Format string contains an unescaped latin alphabet character `" + b + "`"
|
|
3107
|
+
);
|
|
3108
|
+
if (f === "''" ? f = "'" : b === "'" && (f = lr(f)), r.indexOf(f) === 0)
|
|
3109
|
+
r = r.slice(f.length);
|
|
3110
|
+
else
|
|
3111
|
+
return a();
|
|
3112
|
+
}
|
|
3113
|
+
}
|
|
3114
|
+
if (r.length > 0 && cr.test(r))
|
|
3115
|
+
return a();
|
|
3116
|
+
const x = h.map((f) => f.priority).sort((f, b) => b - f).filter((f, b, k) => k.indexOf(f) === b).map(
|
|
3117
|
+
(f) => h.filter((b) => b.priority === f).sort((b, k) => k.subPriority - b.subPriority)
|
|
3118
|
+
).map((f) => f[0]);
|
|
3119
|
+
let T = w(t, n?.in);
|
|
3120
|
+
if (isNaN(+T)) return a();
|
|
3121
|
+
const W = {};
|
|
3122
|
+
for (const f of x) {
|
|
3123
|
+
if (!f.validate(T, l))
|
|
3124
|
+
return a();
|
|
3125
|
+
const b = f.set(T, W, l);
|
|
3126
|
+
Array.isArray(b) ? (T = b[0], Object.assign(W, b[1])) : T = b;
|
|
3127
|
+
}
|
|
3128
|
+
return T;
|
|
3129
|
+
}
|
|
3130
|
+
function lr(r) {
|
|
3131
|
+
return r.match(or)[1].replace(ir, "'");
|
|
3132
|
+
}
|
|
3133
|
+
const fr = (r) => new Date(r.getTime() + 324e5), hr = (r, e = "yyyy-MM-dd") => un(r, e), mr = (r) => ln(r), wr = (r, e) => dr(r, e ?? "yyyy-MM-dd", /* @__PURE__ */ new Date()), gr = (r, e) => wn(r, e) ? r : e, yr = (r, e) => mn(r, e) ? r : e, br = (r, e) => {
|
|
3134
|
+
const t = /* @__PURE__ */ new Date(), n = t >= r, s = { ...{
|
|
3135
|
+
direction: n ? "전" : "후",
|
|
3136
|
+
seconds: n ? "방금" : "잠시",
|
|
3137
|
+
minutes: "분",
|
|
3138
|
+
hours: "시간",
|
|
3139
|
+
days: "일",
|
|
3140
|
+
weeks: "주",
|
|
3141
|
+
months: "개월",
|
|
3142
|
+
years: "년"
|
|
3143
|
+
}, ...e }, o = [
|
|
3144
|
+
{ diffFunc: dt, limit: 60, label: s.minutes },
|
|
3145
|
+
{ diffFunc: ct, limit: 24, label: s.hours },
|
|
3146
|
+
{ diffFunc: ye, limit: 7, label: s.days },
|
|
3147
|
+
{ diffFunc: wt, limit: 5, label: s.weeks },
|
|
3148
|
+
{ diffFunc: mt, limit: 12, label: s.months },
|
|
3149
|
+
{ diffFunc: gt, limit: 1 / 0, label: s.years }
|
|
3150
|
+
];
|
|
3151
|
+
for (const i of o) {
|
|
3152
|
+
const c = Math.abs(i.diffFunc(t, r));
|
|
3153
|
+
if (c >= 1 && c < i.limit) return `${c}${i.label} ${s.direction}`;
|
|
3154
|
+
}
|
|
3155
|
+
return n ? `${s.seconds} ${s.direction}` : `${s.seconds} ${s.direction}`;
|
|
3156
|
+
}, Dr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3157
|
+
__proto__: null,
|
|
3158
|
+
afterDate: yr,
|
|
3159
|
+
beforeDate: gr,
|
|
3160
|
+
formatDate: hr,
|
|
3161
|
+
parseDate: wr,
|
|
3162
|
+
relativeTime: br,
|
|
3163
|
+
toISO: mr,
|
|
3164
|
+
utcToKst: fr
|
|
3165
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
152
3166
|
export {
|
|
153
|
-
|
|
154
|
-
|
|
3167
|
+
xr as FormatData,
|
|
3168
|
+
Dr as dateUtils,
|
|
3169
|
+
ve as filterParams,
|
|
3170
|
+
pr as userAgent,
|
|
3171
|
+
Mr as validate
|
|
155
3172
|
};
|