@sbb-esta/lyne-elements-experimental 1.9.0 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/datetime.js +116 -105
- package/core/timetable/access-leg-helper.d.ts +2 -1
- package/core/timetable/access-leg-helper.d.ts.map +1 -1
- package/core/timetable.js +111 -76
- package/custom-elements.json +44 -0
- package/development/core/datetime.js +53 -51
- package/development/core/timetable/access-leg-helper.d.ts +2 -1
- package/development/core/timetable/access-leg-helper.d.ts.map +1 -1
- package/development/core/timetable.js +57 -22
- package/development/differenceInMinutes-Cmyza6nm.js +26 -0
- package/development/format-DTy5_IOt.js +1371 -0
- package/development/isValid-DO_pHwcW.js +53 -0
- package/development/journey-summary.js +4 -17
- package/development/pearl-chain/pearl-chain.sample-data.d.ts +1 -0
- package/development/pearl-chain/pearl-chain.sample-data.d.ts.map +1 -1
- package/development/pearl-chain-time/pearl-chain-time.d.ts +2 -0
- package/development/pearl-chain-time/pearl-chain-time.d.ts.map +1 -1
- package/development/pearl-chain-time.js +21 -21
- package/development/pearl-chain-vertical-item.js +2 -15
- package/development/pearl-chain-vertical.js +2 -15
- package/development/pearl-chain.js +8 -25
- package/development/timetable-duration.js +2 -15
- package/development/timetable-row/timetable-row.d.ts +7 -0
- package/development/timetable-row/timetable-row.d.ts.map +1 -1
- package/development/timetable-row/timetable-row.sample-data.d.ts +2 -0
- package/development/timetable-row/timetable-row.sample-data.d.ts.map +1 -1
- package/development/timetable-row.js +9 -17
- package/development/toDate-B6IBgPYH.js +24 -0
- package/differenceInMinutes-BI2zjbtS.js +23 -0
- package/{format-fWxoS2xH.js → format-oBQcGL50.js} +343 -344
- package/isValid-mroh13Xp.js +45 -0
- package/journey-summary.js +2 -2
- package/package.json +2 -2
- package/pearl-chain/pearl-chain.sample-data.d.ts +1 -0
- package/pearl-chain/pearl-chain.sample-data.d.ts.map +1 -1
- package/pearl-chain-time/pearl-chain-time.d.ts +2 -0
- package/pearl-chain-time/pearl-chain-time.d.ts.map +1 -1
- package/pearl-chain-time.js +38 -34
- package/pearl-chain.js +57 -59
- package/timetable-row/timetable-row.d.ts +7 -0
- package/timetable-row/timetable-row.d.ts.map +1 -1
- package/timetable-row/timetable-row.sample-data.d.ts +2 -0
- package/timetable-row/timetable-row.sample-data.d.ts.map +1 -1
- package/timetable-row.js +41 -36
- package/toDate-DQg4ZFnf.js +15 -0
- package/constants-DSR8hPvP.js +0 -16
- package/development/constants-BMGwMkN3.js +0 -30
- package/development/differenceInMinutes-DHtPDiUE.js +0 -30
- package/development/format-DkbylFCM.js +0 -1373
- package/development/isValid-BVccOlli.js +0 -44
- package/differenceInMinutes-BhHyuJc4.js +0 -28
- package/isValid-DSjxf8eh.js +0 -36
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { d as
|
|
2
|
-
import { t as w, c as
|
|
3
|
-
let
|
|
4
|
-
function
|
|
5
|
-
return
|
|
1
|
+
import { d as X, i as L } from "./isValid-mroh13Xp.js";
|
|
2
|
+
import { t as w, c as P, m as C } from "./toDate-DQg4ZFnf.js";
|
|
3
|
+
let G = {};
|
|
4
|
+
function S() {
|
|
5
|
+
return G;
|
|
6
6
|
}
|
|
7
|
-
function x(
|
|
7
|
+
function x(n, t) {
|
|
8
8
|
var u, c, d, f;
|
|
9
|
-
const
|
|
9
|
+
const e = S(), r = (t == null ? void 0 : t.weekStartsOn) ?? ((c = (u = t == null ? void 0 : t.locale) == null ? void 0 : u.options) == null ? void 0 : c.weekStartsOn) ?? e.weekStartsOn ?? ((f = (d = e.locale) == null ? void 0 : d.options) == null ? void 0 : f.weekStartsOn) ?? 0, a = w(n, t == null ? void 0 : t.in), i = a.getDay(), s = (i < r ? 7 : 0) + i - r;
|
|
10
10
|
return a.setDate(a.getDate() - s), a.setHours(0, 0, 0, 0), a;
|
|
11
11
|
}
|
|
12
|
-
function W(t) {
|
|
13
|
-
return x(
|
|
12
|
+
function W(n, t) {
|
|
13
|
+
return x(n, { ...t, weekStartsOn: 1 });
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
const e = w(t),
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
return e.getTime() >=
|
|
15
|
+
function N(n, t) {
|
|
16
|
+
const e = w(n, t == null ? void 0 : t.in), r = e.getFullYear(), a = P(e, 0);
|
|
17
|
+
a.setFullYear(r + 1, 0, 4), a.setHours(0, 0, 0, 0);
|
|
18
|
+
const i = W(a), s = P(e, 0);
|
|
19
|
+
s.setFullYear(r, 0, 4), s.setHours(0, 0, 0, 0);
|
|
20
|
+
const u = W(s);
|
|
21
|
+
return e.getTime() >= i.getTime() ? r + 1 : e.getTime() >= u.getTime() ? r : r - 1;
|
|
22
22
|
}
|
|
23
|
-
function
|
|
24
|
-
const e =
|
|
25
|
-
return
|
|
23
|
+
function _(n, t) {
|
|
24
|
+
const e = N(n, t), r = P(n, 0);
|
|
25
|
+
return r.setFullYear(e, 0, 4), r.setHours(0, 0, 0, 0), W(r);
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
const e = w(
|
|
29
|
-
return
|
|
27
|
+
function B(n, t) {
|
|
28
|
+
const e = w(n, t == null ? void 0 : t.in);
|
|
29
|
+
return e.setFullYear(e.getFullYear(), 0, 1), e.setHours(0, 0, 0, 0), e;
|
|
30
30
|
}
|
|
31
|
-
const
|
|
31
|
+
const R = {
|
|
32
32
|
lessThanXSeconds: {
|
|
33
33
|
one: "less than a second",
|
|
34
34
|
other: "less than {{count}} seconds"
|
|
@@ -90,44 +90,44 @@ const B = {
|
|
|
90
90
|
one: "almost 1 year",
|
|
91
91
|
other: "almost {{count}} years"
|
|
92
92
|
}
|
|
93
|
-
},
|
|
93
|
+
}, A = (n, t, e) => {
|
|
94
94
|
let r;
|
|
95
|
-
const a =
|
|
96
|
-
return typeof a == "string" ? r = a :
|
|
95
|
+
const a = R[n];
|
|
96
|
+
return typeof a == "string" ? r = a : t === 1 ? r = a.one : r = a.other.replace("{{count}}", t.toString()), e != null && e.addSuffix ? e.comparison && e.comparison > 0 ? "in " + r : r + " ago" : r;
|
|
97
97
|
};
|
|
98
|
-
function
|
|
99
|
-
return (
|
|
100
|
-
const
|
|
101
|
-
return
|
|
98
|
+
function D(n) {
|
|
99
|
+
return (t = {}) => {
|
|
100
|
+
const e = t.width ? String(t.width) : n.defaultWidth;
|
|
101
|
+
return n.formats[e] || n.formats[n.defaultWidth];
|
|
102
102
|
};
|
|
103
103
|
}
|
|
104
|
-
const
|
|
104
|
+
const V = {
|
|
105
105
|
full: "EEEE, MMMM do, y",
|
|
106
106
|
long: "MMMM do, y",
|
|
107
107
|
medium: "MMM d, y",
|
|
108
108
|
short: "MM/dd/yyyy"
|
|
109
|
-
},
|
|
109
|
+
}, j = {
|
|
110
110
|
full: "h:mm:ss a zzzz",
|
|
111
111
|
long: "h:mm:ss a z",
|
|
112
112
|
medium: "h:mm:ss a",
|
|
113
113
|
short: "h:mm a"
|
|
114
|
-
},
|
|
114
|
+
}, p = {
|
|
115
115
|
full: "{{date}} 'at' {{time}}",
|
|
116
116
|
long: "{{date}} 'at' {{time}}",
|
|
117
117
|
medium: "{{date}}, {{time}}",
|
|
118
118
|
short: "{{date}}, {{time}}"
|
|
119
119
|
}, I = {
|
|
120
|
-
date:
|
|
121
|
-
formats: A,
|
|
122
|
-
defaultWidth: "full"
|
|
123
|
-
}),
|
|
124
|
-
time: Y({
|
|
120
|
+
date: D({
|
|
125
121
|
formats: V,
|
|
126
122
|
defaultWidth: "full"
|
|
127
123
|
}),
|
|
128
|
-
|
|
124
|
+
time: D({
|
|
129
125
|
formats: j,
|
|
130
126
|
defaultWidth: "full"
|
|
127
|
+
}),
|
|
128
|
+
dateTime: D({
|
|
129
|
+
formats: p,
|
|
130
|
+
defaultWidth: "full"
|
|
131
131
|
})
|
|
132
132
|
}, J = {
|
|
133
133
|
lastWeek: "'last' eeee 'at' p",
|
|
@@ -136,19 +136,19 @@ const A = {
|
|
|
136
136
|
tomorrow: "'tomorrow at' p",
|
|
137
137
|
nextWeek: "eeee 'at' p",
|
|
138
138
|
other: "P"
|
|
139
|
-
}, $ = (t, e,
|
|
140
|
-
function v(
|
|
141
|
-
return (
|
|
142
|
-
const r =
|
|
139
|
+
}, $ = (n, t, e, r) => J[n];
|
|
140
|
+
function v(n) {
|
|
141
|
+
return (t, e) => {
|
|
142
|
+
const r = e != null && e.context ? String(e.context) : "standalone";
|
|
143
143
|
let a;
|
|
144
|
-
if (r === "formatting" &&
|
|
145
|
-
const s =
|
|
146
|
-
a =
|
|
144
|
+
if (r === "formatting" && n.formattingValues) {
|
|
145
|
+
const s = n.defaultFormattingWidth || n.defaultWidth, u = e != null && e.width ? String(e.width) : s;
|
|
146
|
+
a = n.formattingValues[u] || n.formattingValues[s];
|
|
147
147
|
} else {
|
|
148
|
-
const s =
|
|
149
|
-
a =
|
|
148
|
+
const s = n.defaultWidth, u = e != null && e.width ? String(e.width) : n.defaultWidth;
|
|
149
|
+
a = n.values[u] || n.values[s];
|
|
150
150
|
}
|
|
151
|
-
const i =
|
|
151
|
+
const i = n.argumentCallback ? n.argumentCallback(t) : t;
|
|
152
152
|
return a[i];
|
|
153
153
|
};
|
|
154
154
|
}
|
|
@@ -265,18 +265,18 @@ const K = {
|
|
|
265
265
|
evening: "in the evening",
|
|
266
266
|
night: "at night"
|
|
267
267
|
}
|
|
268
|
-
}, nt = (
|
|
269
|
-
const
|
|
268
|
+
}, nt = (n, t) => {
|
|
269
|
+
const e = Number(n), r = e % 100;
|
|
270
270
|
if (r > 20 || r < 10)
|
|
271
271
|
switch (r % 10) {
|
|
272
272
|
case 1:
|
|
273
|
-
return
|
|
273
|
+
return e + "st";
|
|
274
274
|
case 2:
|
|
275
|
-
return
|
|
275
|
+
return e + "nd";
|
|
276
276
|
case 3:
|
|
277
|
-
return
|
|
277
|
+
return e + "rd";
|
|
278
278
|
}
|
|
279
|
-
return
|
|
279
|
+
return e + "th";
|
|
280
280
|
}, rt = {
|
|
281
281
|
ordinalNumber: nt,
|
|
282
282
|
era: v({
|
|
@@ -286,7 +286,7 @@ const K = {
|
|
|
286
286
|
quarter: v({
|
|
287
287
|
values: U,
|
|
288
288
|
defaultWidth: "wide",
|
|
289
|
-
argumentCallback: (
|
|
289
|
+
argumentCallback: (n) => n - 1
|
|
290
290
|
}),
|
|
291
291
|
month: v({
|
|
292
292
|
values: z,
|
|
@@ -303,43 +303,43 @@ const K = {
|
|
|
303
303
|
defaultFormattingWidth: "wide"
|
|
304
304
|
})
|
|
305
305
|
};
|
|
306
|
-
function k(
|
|
307
|
-
return (
|
|
308
|
-
const r =
|
|
306
|
+
function k(n) {
|
|
307
|
+
return (t, e = {}) => {
|
|
308
|
+
const r = e.width, a = r && n.matchPatterns[r] || n.matchPatterns[n.defaultMatchWidth], i = t.match(a);
|
|
309
309
|
if (!i)
|
|
310
310
|
return null;
|
|
311
|
-
const s = i[0], u = r &&
|
|
312
|
-
//
|
|
311
|
+
const s = i[0], u = r && n.parsePatterns[r] || n.parsePatterns[n.defaultParseWidth], c = Array.isArray(u) ? it(u, (l) => l.test(s)) : (
|
|
312
|
+
// [TODO] -- I challenge you to fix the type
|
|
313
313
|
at(u, (l) => l.test(s))
|
|
314
314
|
);
|
|
315
315
|
let d;
|
|
316
|
-
d =
|
|
317
|
-
//
|
|
318
|
-
|
|
316
|
+
d = n.valueCallback ? n.valueCallback(c) : c, d = e.valueCallback ? (
|
|
317
|
+
// [TODO] -- I challenge you to fix the type
|
|
318
|
+
e.valueCallback(d)
|
|
319
319
|
) : d;
|
|
320
|
-
const f =
|
|
320
|
+
const f = t.slice(s.length);
|
|
321
321
|
return { value: d, rest: f };
|
|
322
322
|
};
|
|
323
323
|
}
|
|
324
|
-
function at(
|
|
325
|
-
for (const
|
|
326
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
327
|
-
return
|
|
324
|
+
function at(n, t) {
|
|
325
|
+
for (const e in n)
|
|
326
|
+
if (Object.prototype.hasOwnProperty.call(n, e) && t(n[e]))
|
|
327
|
+
return e;
|
|
328
328
|
}
|
|
329
|
-
function it(
|
|
330
|
-
for (let
|
|
331
|
-
if (
|
|
332
|
-
return
|
|
329
|
+
function it(n, t) {
|
|
330
|
+
for (let e = 0; e < n.length; e++)
|
|
331
|
+
if (t(n[e]))
|
|
332
|
+
return e;
|
|
333
333
|
}
|
|
334
|
-
function ot(
|
|
335
|
-
return (
|
|
336
|
-
const r =
|
|
334
|
+
function ot(n) {
|
|
335
|
+
return (t, e = {}) => {
|
|
336
|
+
const r = t.match(n.matchPattern);
|
|
337
337
|
if (!r) return null;
|
|
338
|
-
const a = r[0], i =
|
|
338
|
+
const a = r[0], i = t.match(n.parsePattern);
|
|
339
339
|
if (!i) return null;
|
|
340
|
-
let s =
|
|
341
|
-
s =
|
|
342
|
-
const u =
|
|
340
|
+
let s = n.valueCallback ? n.valueCallback(i[0]) : i[0];
|
|
341
|
+
s = e.valueCallback ? e.valueCallback(s) : s;
|
|
342
|
+
const u = t.slice(a.length);
|
|
343
343
|
return { value: s, rest: u };
|
|
344
344
|
};
|
|
345
345
|
}
|
|
@@ -414,7 +414,7 @@ const st = /^(\d+)(th|st|nd|rd)?/i, ut = /\d+/i, ct = {
|
|
|
414
414
|
ordinalNumber: ot({
|
|
415
415
|
matchPattern: st,
|
|
416
416
|
parsePattern: ut,
|
|
417
|
-
valueCallback: (
|
|
417
|
+
valueCallback: (n) => parseInt(n, 10)
|
|
418
418
|
}),
|
|
419
419
|
era: k({
|
|
420
420
|
matchPatterns: ct,
|
|
@@ -427,7 +427,7 @@ const st = /^(\d+)(th|st|nd|rd)?/i, ut = /\d+/i, ct = {
|
|
|
427
427
|
defaultMatchWidth: "wide",
|
|
428
428
|
parsePatterns: ft,
|
|
429
429
|
defaultParseWidth: "any",
|
|
430
|
-
valueCallback: (
|
|
430
|
+
valueCallback: (n) => n + 1
|
|
431
431
|
}),
|
|
432
432
|
month: k({
|
|
433
433
|
matchPatterns: mt,
|
|
@@ -449,7 +449,7 @@ const st = /^(\d+)(th|st|nd|rd)?/i, ut = /\d+/i, ct = {
|
|
|
449
449
|
})
|
|
450
450
|
}, Mt = {
|
|
451
451
|
code: "en-US",
|
|
452
|
-
formatDistance:
|
|
452
|
+
formatDistance: A,
|
|
453
453
|
formatLong: I,
|
|
454
454
|
formatRelative: $,
|
|
455
455
|
localize: rt,
|
|
@@ -459,91 +459,91 @@ const st = /^(\d+)(th|st|nd|rd)?/i, ut = /\d+/i, ct = {
|
|
|
459
459
|
firstWeekContainsDate: 1
|
|
460
460
|
}
|
|
461
461
|
};
|
|
462
|
-
function Ot(t) {
|
|
463
|
-
const e = w(t);
|
|
464
|
-
return
|
|
462
|
+
function Ot(n, t) {
|
|
463
|
+
const e = w(n, t == null ? void 0 : t.in);
|
|
464
|
+
return X(e, B(e)) + 1;
|
|
465
465
|
}
|
|
466
|
-
function vt(t) {
|
|
467
|
-
const e = w(t),
|
|
468
|
-
return Math.round(
|
|
466
|
+
function vt(n, t) {
|
|
467
|
+
const e = w(n, t == null ? void 0 : t.in), r = +W(e) - +_(e);
|
|
468
|
+
return Math.round(r / C) + 1;
|
|
469
469
|
}
|
|
470
|
-
function
|
|
470
|
+
function H(n, t) {
|
|
471
471
|
var f, l, M, O;
|
|
472
|
-
const
|
|
472
|
+
const e = w(n, t == null ? void 0 : t.in), r = e.getFullYear(), a = S(), i = (t == null ? void 0 : t.firstWeekContainsDate) ?? ((l = (f = t == null ? void 0 : t.locale) == null ? void 0 : f.options) == null ? void 0 : l.firstWeekContainsDate) ?? a.firstWeekContainsDate ?? ((O = (M = a.locale) == null ? void 0 : M.options) == null ? void 0 : O.firstWeekContainsDate) ?? 1, s = P((t == null ? void 0 : t.in) || n, 0);
|
|
473
473
|
s.setFullYear(r + 1, 0, i), s.setHours(0, 0, 0, 0);
|
|
474
|
-
const u = x(s,
|
|
474
|
+
const u = x(s, t), c = P((t == null ? void 0 : t.in) || n, 0);
|
|
475
475
|
c.setFullYear(r, 0, i), c.setHours(0, 0, 0, 0);
|
|
476
|
-
const d = x(c,
|
|
477
|
-
return
|
|
476
|
+
const d = x(c, t);
|
|
477
|
+
return +e >= +u ? r + 1 : +e >= +d ? r : r - 1;
|
|
478
478
|
}
|
|
479
|
-
function kt(
|
|
479
|
+
function kt(n, t) {
|
|
480
480
|
var u, c, d, f;
|
|
481
|
-
const
|
|
482
|
-
return i.setFullYear(a, 0, r), i.setHours(0, 0, 0, 0), x(i,
|
|
481
|
+
const e = S(), r = (t == null ? void 0 : t.firstWeekContainsDate) ?? ((c = (u = t == null ? void 0 : t.locale) == null ? void 0 : u.options) == null ? void 0 : c.firstWeekContainsDate) ?? e.firstWeekContainsDate ?? ((f = (d = e.locale) == null ? void 0 : d.options) == null ? void 0 : f.firstWeekContainsDate) ?? 1, a = H(n, t), i = P((t == null ? void 0 : t.in) || n, 0);
|
|
482
|
+
return i.setFullYear(a, 0, r), i.setHours(0, 0, 0, 0), x(i, t);
|
|
483
483
|
}
|
|
484
|
-
function xt(
|
|
485
|
-
const
|
|
486
|
-
return Math.round(r /
|
|
484
|
+
function xt(n, t) {
|
|
485
|
+
const e = w(n, t == null ? void 0 : t.in), r = +x(e, t) - +kt(e, t);
|
|
486
|
+
return Math.round(r / C) + 1;
|
|
487
487
|
}
|
|
488
|
-
function o(
|
|
489
|
-
const
|
|
490
|
-
return
|
|
488
|
+
function o(n, t) {
|
|
489
|
+
const e = n < 0 ? "-" : "", r = Math.abs(n).toString().padStart(t, "0");
|
|
490
|
+
return e + r;
|
|
491
491
|
}
|
|
492
492
|
const g = {
|
|
493
493
|
// Year
|
|
494
|
-
y(
|
|
495
|
-
const
|
|
496
|
-
return o(
|
|
494
|
+
y(n, t) {
|
|
495
|
+
const e = n.getFullYear(), r = e > 0 ? e : 1 - e;
|
|
496
|
+
return o(t === "yy" ? r % 100 : r, t.length);
|
|
497
497
|
},
|
|
498
498
|
// Month
|
|
499
|
-
M(
|
|
500
|
-
const
|
|
501
|
-
return
|
|
499
|
+
M(n, t) {
|
|
500
|
+
const e = n.getMonth();
|
|
501
|
+
return t === "M" ? String(e + 1) : o(e + 1, 2);
|
|
502
502
|
},
|
|
503
503
|
// Day of the month
|
|
504
|
-
d(
|
|
505
|
-
return o(
|
|
504
|
+
d(n, t) {
|
|
505
|
+
return o(n.getDate(), t.length);
|
|
506
506
|
},
|
|
507
507
|
// AM or PM
|
|
508
|
-
a(
|
|
509
|
-
const
|
|
510
|
-
switch (
|
|
508
|
+
a(n, t) {
|
|
509
|
+
const e = n.getHours() / 12 >= 1 ? "pm" : "am";
|
|
510
|
+
switch (t) {
|
|
511
511
|
case "a":
|
|
512
512
|
case "aa":
|
|
513
|
-
return
|
|
513
|
+
return e.toUpperCase();
|
|
514
514
|
case "aaa":
|
|
515
|
-
return
|
|
515
|
+
return e;
|
|
516
516
|
case "aaaaa":
|
|
517
|
-
return
|
|
517
|
+
return e[0];
|
|
518
518
|
case "aaaa":
|
|
519
519
|
default:
|
|
520
|
-
return
|
|
520
|
+
return e === "am" ? "a.m." : "p.m.";
|
|
521
521
|
}
|
|
522
522
|
},
|
|
523
523
|
// Hour [1-12]
|
|
524
|
-
h(
|
|
525
|
-
return o(
|
|
524
|
+
h(n, t) {
|
|
525
|
+
return o(n.getHours() % 12 || 12, t.length);
|
|
526
526
|
},
|
|
527
527
|
// Hour [0-23]
|
|
528
|
-
H(
|
|
529
|
-
return o(
|
|
528
|
+
H(n, t) {
|
|
529
|
+
return o(n.getHours(), t.length);
|
|
530
530
|
},
|
|
531
531
|
// Minute
|
|
532
|
-
m(
|
|
533
|
-
return o(
|
|
532
|
+
m(n, t) {
|
|
533
|
+
return o(n.getMinutes(), t.length);
|
|
534
534
|
},
|
|
535
535
|
// Second
|
|
536
|
-
s(
|
|
537
|
-
return o(
|
|
536
|
+
s(n, t) {
|
|
537
|
+
return o(n.getSeconds(), t.length);
|
|
538
538
|
},
|
|
539
539
|
// Fraction of second
|
|
540
|
-
S(
|
|
541
|
-
const
|
|
542
|
-
r * Math.pow(10,
|
|
540
|
+
S(n, t) {
|
|
541
|
+
const e = t.length, r = n.getMilliseconds(), a = Math.trunc(
|
|
542
|
+
r * Math.pow(10, e - 3)
|
|
543
543
|
);
|
|
544
|
-
return o(a,
|
|
544
|
+
return o(a, t.length);
|
|
545
545
|
}
|
|
546
|
-
},
|
|
546
|
+
}, b = {
|
|
547
547
|
am: "am",
|
|
548
548
|
pm: "pm",
|
|
549
549
|
midnight: "midnight",
|
|
@@ -554,41 +554,41 @@ const g = {
|
|
|
554
554
|
night: "night"
|
|
555
555
|
}, T = {
|
|
556
556
|
// Era
|
|
557
|
-
G: function(t, e
|
|
558
|
-
const r =
|
|
559
|
-
switch (
|
|
557
|
+
G: function(n, t, e) {
|
|
558
|
+
const r = n.getFullYear() > 0 ? 1 : 0;
|
|
559
|
+
switch (t) {
|
|
560
560
|
case "G":
|
|
561
561
|
case "GG":
|
|
562
562
|
case "GGG":
|
|
563
|
-
return
|
|
563
|
+
return e.era(r, { width: "abbreviated" });
|
|
564
564
|
case "GGGGG":
|
|
565
|
-
return
|
|
565
|
+
return e.era(r, { width: "narrow" });
|
|
566
566
|
case "GGGG":
|
|
567
567
|
default:
|
|
568
|
-
return
|
|
568
|
+
return e.era(r, { width: "wide" });
|
|
569
569
|
}
|
|
570
570
|
},
|
|
571
571
|
// Year
|
|
572
|
-
y: function(t, e
|
|
573
|
-
if (
|
|
574
|
-
const r =
|
|
575
|
-
return
|
|
572
|
+
y: function(n, t, e) {
|
|
573
|
+
if (t === "yo") {
|
|
574
|
+
const r = n.getFullYear(), a = r > 0 ? r : 1 - r;
|
|
575
|
+
return e.ordinalNumber(a, { unit: "year" });
|
|
576
576
|
}
|
|
577
|
-
return g.y(
|
|
577
|
+
return g.y(n, t);
|
|
578
578
|
},
|
|
579
579
|
// Local week-numbering year
|
|
580
|
-
Y: function(t, e,
|
|
581
|
-
const a =
|
|
582
|
-
if (
|
|
580
|
+
Y: function(n, t, e, r) {
|
|
581
|
+
const a = H(n, r), i = a > 0 ? a : 1 - a;
|
|
582
|
+
if (t === "YY") {
|
|
583
583
|
const s = i % 100;
|
|
584
584
|
return o(s, 2);
|
|
585
585
|
}
|
|
586
|
-
return
|
|
586
|
+
return t === "Yo" ? e.ordinalNumber(i, { unit: "year" }) : o(i, t.length);
|
|
587
587
|
},
|
|
588
588
|
// ISO week-numbering year
|
|
589
|
-
R: function(
|
|
590
|
-
const
|
|
591
|
-
return o(
|
|
589
|
+
R: function(n, t) {
|
|
590
|
+
const e = N(n);
|
|
591
|
+
return o(e, t.length);
|
|
592
592
|
},
|
|
593
593
|
// Extended year. This is a single number designating the year of this calendar system.
|
|
594
594
|
// The main difference between `y` and `u` localizers are B.C. years:
|
|
@@ -599,386 +599,386 @@ const g = {
|
|
|
599
599
|
// | BC 2 | 2 | -1 |
|
|
600
600
|
// Also `yy` always returns the last two digits of a year,
|
|
601
601
|
// while `uu` pads single digit years to 2 characters and returns other years unchanged.
|
|
602
|
-
u: function(
|
|
603
|
-
const
|
|
604
|
-
return o(
|
|
602
|
+
u: function(n, t) {
|
|
603
|
+
const e = n.getFullYear();
|
|
604
|
+
return o(e, t.length);
|
|
605
605
|
},
|
|
606
606
|
// Quarter
|
|
607
|
-
Q: function(t, e
|
|
608
|
-
const r = Math.ceil((
|
|
609
|
-
switch (
|
|
607
|
+
Q: function(n, t, e) {
|
|
608
|
+
const r = Math.ceil((n.getMonth() + 1) / 3);
|
|
609
|
+
switch (t) {
|
|
610
610
|
case "Q":
|
|
611
611
|
return String(r);
|
|
612
612
|
case "QQ":
|
|
613
613
|
return o(r, 2);
|
|
614
614
|
case "Qo":
|
|
615
|
-
return
|
|
615
|
+
return e.ordinalNumber(r, { unit: "quarter" });
|
|
616
616
|
case "QQQ":
|
|
617
|
-
return
|
|
617
|
+
return e.quarter(r, {
|
|
618
618
|
width: "abbreviated",
|
|
619
619
|
context: "formatting"
|
|
620
620
|
});
|
|
621
621
|
case "QQQQQ":
|
|
622
|
-
return
|
|
622
|
+
return e.quarter(r, {
|
|
623
623
|
width: "narrow",
|
|
624
624
|
context: "formatting"
|
|
625
625
|
});
|
|
626
626
|
case "QQQQ":
|
|
627
627
|
default:
|
|
628
|
-
return
|
|
628
|
+
return e.quarter(r, {
|
|
629
629
|
width: "wide",
|
|
630
630
|
context: "formatting"
|
|
631
631
|
});
|
|
632
632
|
}
|
|
633
633
|
},
|
|
634
634
|
// Stand-alone quarter
|
|
635
|
-
q: function(t, e
|
|
636
|
-
const r = Math.ceil((
|
|
637
|
-
switch (
|
|
635
|
+
q: function(n, t, e) {
|
|
636
|
+
const r = Math.ceil((n.getMonth() + 1) / 3);
|
|
637
|
+
switch (t) {
|
|
638
638
|
case "q":
|
|
639
639
|
return String(r);
|
|
640
640
|
case "qq":
|
|
641
641
|
return o(r, 2);
|
|
642
642
|
case "qo":
|
|
643
|
-
return
|
|
643
|
+
return e.ordinalNumber(r, { unit: "quarter" });
|
|
644
644
|
case "qqq":
|
|
645
|
-
return
|
|
645
|
+
return e.quarter(r, {
|
|
646
646
|
width: "abbreviated",
|
|
647
647
|
context: "standalone"
|
|
648
648
|
});
|
|
649
649
|
case "qqqqq":
|
|
650
|
-
return
|
|
650
|
+
return e.quarter(r, {
|
|
651
651
|
width: "narrow",
|
|
652
652
|
context: "standalone"
|
|
653
653
|
});
|
|
654
654
|
case "qqqq":
|
|
655
655
|
default:
|
|
656
|
-
return
|
|
656
|
+
return e.quarter(r, {
|
|
657
657
|
width: "wide",
|
|
658
658
|
context: "standalone"
|
|
659
659
|
});
|
|
660
660
|
}
|
|
661
661
|
},
|
|
662
662
|
// Month
|
|
663
|
-
M: function(t, e
|
|
664
|
-
const r =
|
|
665
|
-
switch (
|
|
663
|
+
M: function(n, t, e) {
|
|
664
|
+
const r = n.getMonth();
|
|
665
|
+
switch (t) {
|
|
666
666
|
case "M":
|
|
667
667
|
case "MM":
|
|
668
|
-
return g.M(
|
|
668
|
+
return g.M(n, t);
|
|
669
669
|
case "Mo":
|
|
670
|
-
return
|
|
670
|
+
return e.ordinalNumber(r + 1, { unit: "month" });
|
|
671
671
|
case "MMM":
|
|
672
|
-
return
|
|
672
|
+
return e.month(r, {
|
|
673
673
|
width: "abbreviated",
|
|
674
674
|
context: "formatting"
|
|
675
675
|
});
|
|
676
676
|
case "MMMMM":
|
|
677
|
-
return
|
|
677
|
+
return e.month(r, {
|
|
678
678
|
width: "narrow",
|
|
679
679
|
context: "formatting"
|
|
680
680
|
});
|
|
681
681
|
case "MMMM":
|
|
682
682
|
default:
|
|
683
|
-
return
|
|
683
|
+
return e.month(r, { width: "wide", context: "formatting" });
|
|
684
684
|
}
|
|
685
685
|
},
|
|
686
686
|
// Stand-alone month
|
|
687
|
-
L: function(t, e
|
|
688
|
-
const r =
|
|
689
|
-
switch (
|
|
687
|
+
L: function(n, t, e) {
|
|
688
|
+
const r = n.getMonth();
|
|
689
|
+
switch (t) {
|
|
690
690
|
case "L":
|
|
691
691
|
return String(r + 1);
|
|
692
692
|
case "LL":
|
|
693
693
|
return o(r + 1, 2);
|
|
694
694
|
case "Lo":
|
|
695
|
-
return
|
|
695
|
+
return e.ordinalNumber(r + 1, { unit: "month" });
|
|
696
696
|
case "LLL":
|
|
697
|
-
return
|
|
697
|
+
return e.month(r, {
|
|
698
698
|
width: "abbreviated",
|
|
699
699
|
context: "standalone"
|
|
700
700
|
});
|
|
701
701
|
case "LLLLL":
|
|
702
|
-
return
|
|
702
|
+
return e.month(r, {
|
|
703
703
|
width: "narrow",
|
|
704
704
|
context: "standalone"
|
|
705
705
|
});
|
|
706
706
|
case "LLLL":
|
|
707
707
|
default:
|
|
708
|
-
return
|
|
708
|
+
return e.month(r, { width: "wide", context: "standalone" });
|
|
709
709
|
}
|
|
710
710
|
},
|
|
711
711
|
// Local week of year
|
|
712
|
-
w: function(t, e,
|
|
713
|
-
const a = xt(
|
|
714
|
-
return
|
|
712
|
+
w: function(n, t, e, r) {
|
|
713
|
+
const a = xt(n, r);
|
|
714
|
+
return t === "wo" ? e.ordinalNumber(a, { unit: "week" }) : o(a, t.length);
|
|
715
715
|
},
|
|
716
716
|
// ISO week of year
|
|
717
|
-
I: function(t, e
|
|
718
|
-
const r = vt(
|
|
719
|
-
return
|
|
717
|
+
I: function(n, t, e) {
|
|
718
|
+
const r = vt(n);
|
|
719
|
+
return t === "Io" ? e.ordinalNumber(r, { unit: "week" }) : o(r, t.length);
|
|
720
720
|
},
|
|
721
721
|
// Day of the month
|
|
722
|
-
d: function(t, e
|
|
723
|
-
return
|
|
722
|
+
d: function(n, t, e) {
|
|
723
|
+
return t === "do" ? e.ordinalNumber(n.getDate(), { unit: "date" }) : g.d(n, t);
|
|
724
724
|
},
|
|
725
725
|
// Day of year
|
|
726
|
-
D: function(t, e
|
|
727
|
-
const r = Ot(
|
|
728
|
-
return
|
|
726
|
+
D: function(n, t, e) {
|
|
727
|
+
const r = Ot(n);
|
|
728
|
+
return t === "Do" ? e.ordinalNumber(r, { unit: "dayOfYear" }) : o(r, t.length);
|
|
729
729
|
},
|
|
730
730
|
// Day of week
|
|
731
|
-
E: function(t, e
|
|
732
|
-
const r =
|
|
733
|
-
switch (
|
|
731
|
+
E: function(n, t, e) {
|
|
732
|
+
const r = n.getDay();
|
|
733
|
+
switch (t) {
|
|
734
734
|
case "E":
|
|
735
735
|
case "EE":
|
|
736
736
|
case "EEE":
|
|
737
|
-
return
|
|
737
|
+
return e.day(r, {
|
|
738
738
|
width: "abbreviated",
|
|
739
739
|
context: "formatting"
|
|
740
740
|
});
|
|
741
741
|
case "EEEEE":
|
|
742
|
-
return
|
|
742
|
+
return e.day(r, {
|
|
743
743
|
width: "narrow",
|
|
744
744
|
context: "formatting"
|
|
745
745
|
});
|
|
746
746
|
case "EEEEEE":
|
|
747
|
-
return
|
|
747
|
+
return e.day(r, {
|
|
748
748
|
width: "short",
|
|
749
749
|
context: "formatting"
|
|
750
750
|
});
|
|
751
751
|
case "EEEE":
|
|
752
752
|
default:
|
|
753
|
-
return
|
|
753
|
+
return e.day(r, {
|
|
754
754
|
width: "wide",
|
|
755
755
|
context: "formatting"
|
|
756
756
|
});
|
|
757
757
|
}
|
|
758
758
|
},
|
|
759
759
|
// Local day of week
|
|
760
|
-
e: function(t, e,
|
|
761
|
-
const a =
|
|
762
|
-
switch (
|
|
760
|
+
e: function(n, t, e, r) {
|
|
761
|
+
const a = n.getDay(), i = (a - r.weekStartsOn + 8) % 7 || 7;
|
|
762
|
+
switch (t) {
|
|
763
763
|
case "e":
|
|
764
764
|
return String(i);
|
|
765
765
|
case "ee":
|
|
766
766
|
return o(i, 2);
|
|
767
767
|
case "eo":
|
|
768
|
-
return
|
|
768
|
+
return e.ordinalNumber(i, { unit: "day" });
|
|
769
769
|
case "eee":
|
|
770
|
-
return
|
|
770
|
+
return e.day(a, {
|
|
771
771
|
width: "abbreviated",
|
|
772
772
|
context: "formatting"
|
|
773
773
|
});
|
|
774
774
|
case "eeeee":
|
|
775
|
-
return
|
|
775
|
+
return e.day(a, {
|
|
776
776
|
width: "narrow",
|
|
777
777
|
context: "formatting"
|
|
778
778
|
});
|
|
779
779
|
case "eeeeee":
|
|
780
|
-
return
|
|
780
|
+
return e.day(a, {
|
|
781
781
|
width: "short",
|
|
782
782
|
context: "formatting"
|
|
783
783
|
});
|
|
784
784
|
case "eeee":
|
|
785
785
|
default:
|
|
786
|
-
return
|
|
786
|
+
return e.day(a, {
|
|
787
787
|
width: "wide",
|
|
788
788
|
context: "formatting"
|
|
789
789
|
});
|
|
790
790
|
}
|
|
791
791
|
},
|
|
792
792
|
// Stand-alone local day of week
|
|
793
|
-
c: function(t, e,
|
|
794
|
-
const a =
|
|
795
|
-
switch (
|
|
793
|
+
c: function(n, t, e, r) {
|
|
794
|
+
const a = n.getDay(), i = (a - r.weekStartsOn + 8) % 7 || 7;
|
|
795
|
+
switch (t) {
|
|
796
796
|
case "c":
|
|
797
797
|
return String(i);
|
|
798
798
|
case "cc":
|
|
799
|
-
return o(i,
|
|
799
|
+
return o(i, t.length);
|
|
800
800
|
case "co":
|
|
801
|
-
return
|
|
801
|
+
return e.ordinalNumber(i, { unit: "day" });
|
|
802
802
|
case "ccc":
|
|
803
|
-
return
|
|
803
|
+
return e.day(a, {
|
|
804
804
|
width: "abbreviated",
|
|
805
805
|
context: "standalone"
|
|
806
806
|
});
|
|
807
807
|
case "ccccc":
|
|
808
|
-
return
|
|
808
|
+
return e.day(a, {
|
|
809
809
|
width: "narrow",
|
|
810
810
|
context: "standalone"
|
|
811
811
|
});
|
|
812
812
|
case "cccccc":
|
|
813
|
-
return
|
|
813
|
+
return e.day(a, {
|
|
814
814
|
width: "short",
|
|
815
815
|
context: "standalone"
|
|
816
816
|
});
|
|
817
817
|
case "cccc":
|
|
818
818
|
default:
|
|
819
|
-
return
|
|
819
|
+
return e.day(a, {
|
|
820
820
|
width: "wide",
|
|
821
821
|
context: "standalone"
|
|
822
822
|
});
|
|
823
823
|
}
|
|
824
824
|
},
|
|
825
825
|
// ISO day of week
|
|
826
|
-
i: function(t, e
|
|
827
|
-
const r =
|
|
828
|
-
switch (
|
|
826
|
+
i: function(n, t, e) {
|
|
827
|
+
const r = n.getDay(), a = r === 0 ? 7 : r;
|
|
828
|
+
switch (t) {
|
|
829
829
|
case "i":
|
|
830
830
|
return String(a);
|
|
831
831
|
case "ii":
|
|
832
|
-
return o(a,
|
|
832
|
+
return o(a, t.length);
|
|
833
833
|
case "io":
|
|
834
|
-
return
|
|
834
|
+
return e.ordinalNumber(a, { unit: "day" });
|
|
835
835
|
case "iii":
|
|
836
|
-
return
|
|
836
|
+
return e.day(r, {
|
|
837
837
|
width: "abbreviated",
|
|
838
838
|
context: "formatting"
|
|
839
839
|
});
|
|
840
840
|
case "iiiii":
|
|
841
|
-
return
|
|
841
|
+
return e.day(r, {
|
|
842
842
|
width: "narrow",
|
|
843
843
|
context: "formatting"
|
|
844
844
|
});
|
|
845
845
|
case "iiiiii":
|
|
846
|
-
return
|
|
846
|
+
return e.day(r, {
|
|
847
847
|
width: "short",
|
|
848
848
|
context: "formatting"
|
|
849
849
|
});
|
|
850
850
|
case "iiii":
|
|
851
851
|
default:
|
|
852
|
-
return
|
|
852
|
+
return e.day(r, {
|
|
853
853
|
width: "wide",
|
|
854
854
|
context: "formatting"
|
|
855
855
|
});
|
|
856
856
|
}
|
|
857
857
|
},
|
|
858
858
|
// AM or PM
|
|
859
|
-
a: function(t, e
|
|
860
|
-
const a =
|
|
861
|
-
switch (
|
|
859
|
+
a: function(n, t, e) {
|
|
860
|
+
const a = n.getHours() / 12 >= 1 ? "pm" : "am";
|
|
861
|
+
switch (t) {
|
|
862
862
|
case "a":
|
|
863
863
|
case "aa":
|
|
864
|
-
return
|
|
864
|
+
return e.dayPeriod(a, {
|
|
865
865
|
width: "abbreviated",
|
|
866
866
|
context: "formatting"
|
|
867
867
|
});
|
|
868
868
|
case "aaa":
|
|
869
|
-
return
|
|
869
|
+
return e.dayPeriod(a, {
|
|
870
870
|
width: "abbreviated",
|
|
871
871
|
context: "formatting"
|
|
872
872
|
}).toLowerCase();
|
|
873
873
|
case "aaaaa":
|
|
874
|
-
return
|
|
874
|
+
return e.dayPeriod(a, {
|
|
875
875
|
width: "narrow",
|
|
876
876
|
context: "formatting"
|
|
877
877
|
});
|
|
878
878
|
case "aaaa":
|
|
879
879
|
default:
|
|
880
|
-
return
|
|
880
|
+
return e.dayPeriod(a, {
|
|
881
881
|
width: "wide",
|
|
882
882
|
context: "formatting"
|
|
883
883
|
});
|
|
884
884
|
}
|
|
885
885
|
},
|
|
886
886
|
// AM, PM, midnight, noon
|
|
887
|
-
b: function(t, e
|
|
888
|
-
const r =
|
|
887
|
+
b: function(n, t, e) {
|
|
888
|
+
const r = n.getHours();
|
|
889
889
|
let a;
|
|
890
|
-
switch (r === 12 ? a =
|
|
890
|
+
switch (r === 12 ? a = b.noon : r === 0 ? a = b.midnight : a = r / 12 >= 1 ? "pm" : "am", t) {
|
|
891
891
|
case "b":
|
|
892
892
|
case "bb":
|
|
893
|
-
return
|
|
893
|
+
return e.dayPeriod(a, {
|
|
894
894
|
width: "abbreviated",
|
|
895
895
|
context: "formatting"
|
|
896
896
|
});
|
|
897
897
|
case "bbb":
|
|
898
|
-
return
|
|
898
|
+
return e.dayPeriod(a, {
|
|
899
899
|
width: "abbreviated",
|
|
900
900
|
context: "formatting"
|
|
901
901
|
}).toLowerCase();
|
|
902
902
|
case "bbbbb":
|
|
903
|
-
return
|
|
903
|
+
return e.dayPeriod(a, {
|
|
904
904
|
width: "narrow",
|
|
905
905
|
context: "formatting"
|
|
906
906
|
});
|
|
907
907
|
case "bbbb":
|
|
908
908
|
default:
|
|
909
|
-
return
|
|
909
|
+
return e.dayPeriod(a, {
|
|
910
910
|
width: "wide",
|
|
911
911
|
context: "formatting"
|
|
912
912
|
});
|
|
913
913
|
}
|
|
914
914
|
},
|
|
915
915
|
// in the morning, in the afternoon, in the evening, at night
|
|
916
|
-
B: function(t, e
|
|
917
|
-
const r =
|
|
916
|
+
B: function(n, t, e) {
|
|
917
|
+
const r = n.getHours();
|
|
918
918
|
let a;
|
|
919
|
-
switch (r >= 17 ? a =
|
|
919
|
+
switch (r >= 17 ? a = b.evening : r >= 12 ? a = b.afternoon : r >= 4 ? a = b.morning : a = b.night, t) {
|
|
920
920
|
case "B":
|
|
921
921
|
case "BB":
|
|
922
922
|
case "BBB":
|
|
923
|
-
return
|
|
923
|
+
return e.dayPeriod(a, {
|
|
924
924
|
width: "abbreviated",
|
|
925
925
|
context: "formatting"
|
|
926
926
|
});
|
|
927
927
|
case "BBBBB":
|
|
928
|
-
return
|
|
928
|
+
return e.dayPeriod(a, {
|
|
929
929
|
width: "narrow",
|
|
930
930
|
context: "formatting"
|
|
931
931
|
});
|
|
932
932
|
case "BBBB":
|
|
933
933
|
default:
|
|
934
|
-
return
|
|
934
|
+
return e.dayPeriod(a, {
|
|
935
935
|
width: "wide",
|
|
936
936
|
context: "formatting"
|
|
937
937
|
});
|
|
938
938
|
}
|
|
939
939
|
},
|
|
940
940
|
// Hour [1-12]
|
|
941
|
-
h: function(t, e
|
|
942
|
-
if (
|
|
943
|
-
let r =
|
|
944
|
-
return r === 0 && (r = 12),
|
|
941
|
+
h: function(n, t, e) {
|
|
942
|
+
if (t === "ho") {
|
|
943
|
+
let r = n.getHours() % 12;
|
|
944
|
+
return r === 0 && (r = 12), e.ordinalNumber(r, { unit: "hour" });
|
|
945
945
|
}
|
|
946
|
-
return g.h(
|
|
946
|
+
return g.h(n, t);
|
|
947
947
|
},
|
|
948
948
|
// Hour [0-23]
|
|
949
|
-
H: function(t, e
|
|
950
|
-
return
|
|
949
|
+
H: function(n, t, e) {
|
|
950
|
+
return t === "Ho" ? e.ordinalNumber(n.getHours(), { unit: "hour" }) : g.H(n, t);
|
|
951
951
|
},
|
|
952
952
|
// Hour [0-11]
|
|
953
|
-
K: function(t, e
|
|
954
|
-
const r =
|
|
955
|
-
return
|
|
953
|
+
K: function(n, t, e) {
|
|
954
|
+
const r = n.getHours() % 12;
|
|
955
|
+
return t === "Ko" ? e.ordinalNumber(r, { unit: "hour" }) : o(r, t.length);
|
|
956
956
|
},
|
|
957
957
|
// Hour [1-24]
|
|
958
|
-
k: function(t, e
|
|
959
|
-
let r =
|
|
960
|
-
return r === 0 && (r = 24),
|
|
958
|
+
k: function(n, t, e) {
|
|
959
|
+
let r = n.getHours();
|
|
960
|
+
return r === 0 && (r = 24), t === "ko" ? e.ordinalNumber(r, { unit: "hour" }) : o(r, t.length);
|
|
961
961
|
},
|
|
962
962
|
// Minute
|
|
963
|
-
m: function(t, e
|
|
964
|
-
return
|
|
963
|
+
m: function(n, t, e) {
|
|
964
|
+
return t === "mo" ? e.ordinalNumber(n.getMinutes(), { unit: "minute" }) : g.m(n, t);
|
|
965
965
|
},
|
|
966
966
|
// Second
|
|
967
|
-
s: function(t, e
|
|
968
|
-
return
|
|
967
|
+
s: function(n, t, e) {
|
|
968
|
+
return t === "so" ? e.ordinalNumber(n.getSeconds(), { unit: "second" }) : g.s(n, t);
|
|
969
969
|
},
|
|
970
970
|
// Fraction of second
|
|
971
|
-
S: function(
|
|
972
|
-
return g.S(
|
|
971
|
+
S: function(n, t) {
|
|
972
|
+
return g.S(n, t);
|
|
973
973
|
},
|
|
974
974
|
// Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
|
|
975
|
-
X: function(t, e
|
|
976
|
-
const r =
|
|
975
|
+
X: function(n, t, e) {
|
|
976
|
+
const r = n.getTimezoneOffset();
|
|
977
977
|
if (r === 0)
|
|
978
978
|
return "Z";
|
|
979
|
-
switch (
|
|
979
|
+
switch (t) {
|
|
980
980
|
case "X":
|
|
981
|
-
return
|
|
981
|
+
return F(r);
|
|
982
982
|
case "XXXX":
|
|
983
983
|
case "XX":
|
|
984
984
|
return y(r);
|
|
@@ -989,11 +989,11 @@ const g = {
|
|
|
989
989
|
}
|
|
990
990
|
},
|
|
991
991
|
// Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
|
|
992
|
-
x: function(t, e
|
|
993
|
-
const r =
|
|
994
|
-
switch (
|
|
992
|
+
x: function(n, t, e) {
|
|
993
|
+
const r = n.getTimezoneOffset();
|
|
994
|
+
switch (t) {
|
|
995
995
|
case "x":
|
|
996
|
-
return
|
|
996
|
+
return F(r);
|
|
997
997
|
case "xxxx":
|
|
998
998
|
case "xx":
|
|
999
999
|
return y(r);
|
|
@@ -1004,138 +1004,137 @@ const g = {
|
|
|
1004
1004
|
}
|
|
1005
1005
|
},
|
|
1006
1006
|
// Timezone (GMT)
|
|
1007
|
-
O: function(t, e
|
|
1008
|
-
const r =
|
|
1009
|
-
switch (
|
|
1007
|
+
O: function(n, t, e) {
|
|
1008
|
+
const r = n.getTimezoneOffset();
|
|
1009
|
+
switch (t) {
|
|
1010
1010
|
case "O":
|
|
1011
1011
|
case "OO":
|
|
1012
1012
|
case "OOO":
|
|
1013
|
-
return "GMT" +
|
|
1013
|
+
return "GMT" + E(r, ":");
|
|
1014
1014
|
case "OOOO":
|
|
1015
1015
|
default:
|
|
1016
1016
|
return "GMT" + y(r, ":");
|
|
1017
1017
|
}
|
|
1018
1018
|
},
|
|
1019
1019
|
// Timezone (specific non-location)
|
|
1020
|
-
z: function(t, e
|
|
1021
|
-
const r =
|
|
1022
|
-
switch (
|
|
1020
|
+
z: function(n, t, e) {
|
|
1021
|
+
const r = n.getTimezoneOffset();
|
|
1022
|
+
switch (t) {
|
|
1023
1023
|
case "z":
|
|
1024
1024
|
case "zz":
|
|
1025
1025
|
case "zzz":
|
|
1026
|
-
return "GMT" +
|
|
1026
|
+
return "GMT" + E(r, ":");
|
|
1027
1027
|
case "zzzz":
|
|
1028
1028
|
default:
|
|
1029
1029
|
return "GMT" + y(r, ":");
|
|
1030
1030
|
}
|
|
1031
1031
|
},
|
|
1032
1032
|
// Seconds timestamp
|
|
1033
|
-
t: function(t, e
|
|
1034
|
-
const r = Math.trunc(
|
|
1035
|
-
return o(r,
|
|
1033
|
+
t: function(n, t, e) {
|
|
1034
|
+
const r = Math.trunc(+n / 1e3);
|
|
1035
|
+
return o(r, t.length);
|
|
1036
1036
|
},
|
|
1037
1037
|
// Milliseconds timestamp
|
|
1038
|
-
T: function(t, e
|
|
1039
|
-
|
|
1040
|
-
return o(r, e.length);
|
|
1038
|
+
T: function(n, t, e) {
|
|
1039
|
+
return o(+n, t.length);
|
|
1041
1040
|
}
|
|
1042
1041
|
};
|
|
1043
|
-
function
|
|
1044
|
-
const
|
|
1045
|
-
return i === 0 ?
|
|
1042
|
+
function E(n, t = "") {
|
|
1043
|
+
const e = n > 0 ? "-" : "+", r = Math.abs(n), a = Math.trunc(r / 60), i = r % 60;
|
|
1044
|
+
return i === 0 ? e + String(a) : e + String(a) + t + o(i, 2);
|
|
1046
1045
|
}
|
|
1047
|
-
function
|
|
1048
|
-
return
|
|
1046
|
+
function F(n, t) {
|
|
1047
|
+
return n % 60 === 0 ? (n > 0 ? "-" : "+") + o(Math.abs(n) / 60, 2) : y(n, t);
|
|
1049
1048
|
}
|
|
1050
|
-
function y(
|
|
1051
|
-
const
|
|
1052
|
-
return
|
|
1049
|
+
function y(n, t = "") {
|
|
1050
|
+
const e = n > 0 ? "-" : "+", r = Math.abs(n), a = o(Math.trunc(r / 60), 2), i = o(r % 60, 2);
|
|
1051
|
+
return e + a + t + i;
|
|
1053
1052
|
}
|
|
1054
|
-
const
|
|
1055
|
-
switch (
|
|
1053
|
+
const q = (n, t) => {
|
|
1054
|
+
switch (n) {
|
|
1056
1055
|
case "P":
|
|
1057
|
-
return
|
|
1056
|
+
return t.date({ width: "short" });
|
|
1058
1057
|
case "PP":
|
|
1059
|
-
return
|
|
1058
|
+
return t.date({ width: "medium" });
|
|
1060
1059
|
case "PPP":
|
|
1061
|
-
return
|
|
1060
|
+
return t.date({ width: "long" });
|
|
1062
1061
|
case "PPPP":
|
|
1063
1062
|
default:
|
|
1064
|
-
return
|
|
1063
|
+
return t.date({ width: "full" });
|
|
1065
1064
|
}
|
|
1066
|
-
},
|
|
1067
|
-
switch (
|
|
1065
|
+
}, Q = (n, t) => {
|
|
1066
|
+
switch (n) {
|
|
1068
1067
|
case "p":
|
|
1069
|
-
return
|
|
1068
|
+
return t.time({ width: "short" });
|
|
1070
1069
|
case "pp":
|
|
1071
|
-
return
|
|
1070
|
+
return t.time({ width: "medium" });
|
|
1072
1071
|
case "ppp":
|
|
1073
|
-
return
|
|
1072
|
+
return t.time({ width: "long" });
|
|
1074
1073
|
case "pppp":
|
|
1075
1074
|
default:
|
|
1076
|
-
return
|
|
1075
|
+
return t.time({ width: "full" });
|
|
1077
1076
|
}
|
|
1078
|
-
}, Wt = (
|
|
1079
|
-
const
|
|
1077
|
+
}, Wt = (n, t) => {
|
|
1078
|
+
const e = n.match(/(P+)(p+)?/) || [], r = e[1], a = e[2];
|
|
1080
1079
|
if (!a)
|
|
1081
|
-
return
|
|
1080
|
+
return q(n, t);
|
|
1082
1081
|
let i;
|
|
1083
1082
|
switch (r) {
|
|
1084
1083
|
case "P":
|
|
1085
|
-
i =
|
|
1084
|
+
i = t.dateTime({ width: "short" });
|
|
1086
1085
|
break;
|
|
1087
1086
|
case "PP":
|
|
1088
|
-
i =
|
|
1087
|
+
i = t.dateTime({ width: "medium" });
|
|
1089
1088
|
break;
|
|
1090
1089
|
case "PPP":
|
|
1091
|
-
i =
|
|
1090
|
+
i = t.dateTime({ width: "long" });
|
|
1092
1091
|
break;
|
|
1093
1092
|
case "PPPP":
|
|
1094
1093
|
default:
|
|
1095
|
-
i =
|
|
1094
|
+
i = t.dateTime({ width: "full" });
|
|
1096
1095
|
break;
|
|
1097
1096
|
}
|
|
1098
|
-
return i.replace("{{date}}",
|
|
1099
|
-
},
|
|
1100
|
-
p:
|
|
1097
|
+
return i.replace("{{date}}", q(r, t)).replace("{{time}}", Q(a, t));
|
|
1098
|
+
}, St = {
|
|
1099
|
+
p: Q,
|
|
1101
1100
|
P: Wt
|
|
1102
|
-
},
|
|
1103
|
-
function
|
|
1104
|
-
return
|
|
1101
|
+
}, Yt = /^D+$/, Dt = /^Y+$/, Tt = ["D", "DD", "YY", "YYYY"];
|
|
1102
|
+
function Et(n) {
|
|
1103
|
+
return Yt.test(n);
|
|
1105
1104
|
}
|
|
1106
|
-
function
|
|
1107
|
-
return
|
|
1105
|
+
function Ft(n) {
|
|
1106
|
+
return Dt.test(n);
|
|
1108
1107
|
}
|
|
1109
|
-
function
|
|
1110
|
-
const r =
|
|
1111
|
-
if (console.warn(r), Tt.includes(
|
|
1108
|
+
function qt(n, t, e) {
|
|
1109
|
+
const r = Ct(n, t, e);
|
|
1110
|
+
if (console.warn(r), Tt.includes(n)) throw new RangeError(r);
|
|
1112
1111
|
}
|
|
1113
|
-
function
|
|
1114
|
-
const r =
|
|
1115
|
-
return `Use \`${
|
|
1112
|
+
function Ct(n, t, e) {
|
|
1113
|
+
const r = n[0] === "Y" ? "years" : "days of the month";
|
|
1114
|
+
return `Use \`${n.toLowerCase()}\` instead of \`${n}\` (in \`${t}\`) for formatting ${r} to the input \`${e}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
|
|
1116
1115
|
}
|
|
1117
|
-
const
|
|
1118
|
-
function
|
|
1116
|
+
const Nt = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g, Ht = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g, Qt = /^'([^]*?)'?$/, Xt = /''/g, Lt = /[a-zA-Z]/;
|
|
1117
|
+
function Rt(n, t, e) {
|
|
1119
1118
|
var f, l, M, O;
|
|
1120
|
-
const r =
|
|
1121
|
-
if (!
|
|
1119
|
+
const r = S(), a = r.locale ?? Mt, i = r.firstWeekContainsDate ?? ((l = (f = r.locale) == null ? void 0 : f.options) == null ? void 0 : l.firstWeekContainsDate) ?? 1, s = r.weekStartsOn ?? ((O = (M = r.locale) == null ? void 0 : M.options) == null ? void 0 : O.weekStartsOn) ?? 0, u = w(n, e == null ? void 0 : e.in);
|
|
1120
|
+
if (!L(u))
|
|
1122
1121
|
throw new RangeError("Invalid time value");
|
|
1123
|
-
let c =
|
|
1122
|
+
let c = t.match(Ht).map((m) => {
|
|
1124
1123
|
const h = m[0];
|
|
1125
1124
|
if (h === "p" || h === "P") {
|
|
1126
|
-
const
|
|
1127
|
-
return
|
|
1125
|
+
const Y = St[h];
|
|
1126
|
+
return Y(m, a.formatLong);
|
|
1128
1127
|
}
|
|
1129
1128
|
return m;
|
|
1130
|
-
}).join("").match(
|
|
1129
|
+
}).join("").match(Nt).map((m) => {
|
|
1131
1130
|
if (m === "''")
|
|
1132
1131
|
return { isToken: !1, value: "'" };
|
|
1133
1132
|
const h = m[0];
|
|
1134
1133
|
if (h === "'")
|
|
1135
|
-
return { isToken: !1, value:
|
|
1134
|
+
return { isToken: !1, value: Gt(m) };
|
|
1136
1135
|
if (T[h])
|
|
1137
1136
|
return { isToken: !0, value: m };
|
|
1138
|
-
if (h.match(
|
|
1137
|
+
if (h.match(Lt))
|
|
1139
1138
|
throw new RangeError(
|
|
1140
1139
|
"Format string contains an unescaped latin alphabet character `" + h + "`"
|
|
1141
1140
|
);
|
|
@@ -1150,15 +1149,15 @@ function Bt(t, e, n) {
|
|
|
1150
1149
|
return c.map((m) => {
|
|
1151
1150
|
if (!m.isToken) return m.value;
|
|
1152
1151
|
const h = m.value;
|
|
1153
|
-
(
|
|
1154
|
-
const
|
|
1155
|
-
return
|
|
1152
|
+
(Ft(h) || Et(h)) && qt(h, t, String(n));
|
|
1153
|
+
const Y = T[h[0]];
|
|
1154
|
+
return Y(u, h, a.localize, d);
|
|
1156
1155
|
}).join("");
|
|
1157
1156
|
}
|
|
1158
|
-
function
|
|
1159
|
-
const
|
|
1160
|
-
return
|
|
1157
|
+
function Gt(n) {
|
|
1158
|
+
const t = n.match(Qt);
|
|
1159
|
+
return t ? t[1].replace(Xt, "'") : n;
|
|
1161
1160
|
}
|
|
1162
1161
|
export {
|
|
1163
|
-
|
|
1162
|
+
Rt as f
|
|
1164
1163
|
};
|