@oslokommune/punkt-elements 13.6.12 → 13.7.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/CHANGELOG.md +40 -0
- package/dist/{accordionitem-B_h5XGCo.js → accordionitem-C_URrDjP.js} +4 -4
- package/dist/{accordionitem-BOmnm80g.cjs → accordionitem-DCZrHVNR.cjs} +1 -1
- package/dist/{alert-ZP5-fqlt.cjs → alert-Ci7WvRXi.cjs} +1 -1
- package/dist/{alert-CTTm6ugp.js → alert-Dh1YhaBq.js} +13 -26
- package/dist/{backlink-BT7DO6rV.cjs → backlink-BzEvli8m.cjs} +1 -1
- package/dist/{backlink-Bq8O2bt8.js → backlink-CI_jMGzZ.js} +3 -3
- package/dist/{button-x6Xw-5w0.js → button-CCFAUJa0.js} +5 -5
- package/dist/{button-BfqxLnMT.cjs → button-CXJQ_Wgl.cjs} +1 -1
- package/dist/calendar-BaMrdMDZ.cjs +115 -0
- package/dist/{calendar-CodWwTHM.js → calendar-DtJh7UYD.js} +532 -480
- package/dist/{card-B9RPShvV.cjs → card-Cf-UcGAP.cjs} +1 -1
- package/dist/{card-en2KhOPO.js → card-M1X36b6i.js} +8 -26
- package/dist/{checkbox-CH8xeK-0.cjs → checkbox-CTxc8wQe.cjs} +1 -1
- package/dist/{checkbox-DSAcMC-D.js → checkbox-_5LbXU7N.js} +4 -4
- package/dist/class-map-C_erArZz.cjs +5 -0
- package/dist/{class-map-Dw6Wrxwi.js → class-map-wy7PUk0P.js} +3 -3
- package/dist/{combobox-BFOjlFIj.cjs → combobox-BJ1gA0f0.cjs} +1 -1
- package/dist/{combobox-DaiEdUKx.js → combobox-Ct0NNY1p.js} +12 -16
- package/dist/{consent-CXp0bLvg.js → consent-B2hIQh4b.js} +3 -3
- package/dist/{consent-DFrsiYGQ.cjs → consent-BeOjxQdR.cjs} +1 -1
- package/dist/datepicker-B8mifBAm.js +1374 -0
- package/dist/datepicker-DVqmQAOe.cjs +289 -0
- package/dist/directive-helpers-4oOjKnGY.cjs +5 -0
- package/dist/directive-helpers-BzAtj9by.js +38 -0
- package/dist/{element-D62wHiNU.cjs → element-CJ_QKaki.cjs} +6 -6
- package/dist/{element-DJZPsA_J.js → element-CRDRygXu.js} +47 -132
- package/dist/{heading-H_FWjo2k.cjs → heading--JKFppLS.cjs} +1 -1
- package/dist/{heading-DQ0R34j4.js → heading-Cs5yGnJg.js} +1 -1
- package/dist/{helptext-D1fkGmfT.cjs → helptext-CVQP3pis.cjs} +1 -1
- package/dist/{helptext-8ykxyegi.js → helptext-DuvVSH7d.js} +6 -6
- package/dist/icon-1dy7UZcu.js +89 -0
- package/dist/icon-BGuizDwk.cjs +9 -0
- package/dist/{if-defined-D3lgJqT7.js → if-defined-BWZGb3bh.js} +1 -1
- package/dist/{if-defined-CkVc_RJD.cjs → if-defined-Bc9-_I01.cjs} +1 -1
- package/dist/index.d.ts +98 -6
- package/dist/input-element-BcFmygSF.js +707 -0
- package/dist/input-element-j9znzLWz.cjs +1 -0
- package/dist/{input-wrapper-DVjNwf8-.cjs → input-wrapper-BsQ7oFMd.cjs} +1 -1
- package/dist/input-wrapper-CDgenrYA.js +6 -0
- package/dist/{input-wrapper-CQzXG44g.js → input-wrapper-CKJU0QWG.js} +8 -8
- package/dist/{link-CyiVlb-7.cjs → link-Da3pZ_CW.cjs} +1 -1
- package/dist/{link-DSSJYrtn.js → link-DzZCw8j2.js} +9 -16
- package/dist/{linkcard-fH9uydjS.cjs → linkcard-BM23gzhS.cjs} +1 -1
- package/dist/{linkcard-g8JtooPU.js → linkcard-RIK5xqbd.js} +4 -4
- package/dist/{listbox-L-iOSF7M.cjs → listbox-CsGiqzD0.cjs} +1 -1
- package/dist/{listbox-n4wjlLqD.js → listbox-DlJevu8O.js} +5 -5
- package/dist/{loader-Bzf1sPSg.js → loader-BVvBzaPI.js} +5 -5
- package/dist/{loader-C-3l7kb9.cjs → loader-Bo8RCbCJ.cjs} +1 -1
- package/dist/{messagebox---xPIAwR.cjs → messagebox-C76IcXTl.cjs} +1 -1
- package/dist/{messagebox-okJLeSpj.js → messagebox-DwdMXoAe.js} +6 -16
- package/dist/{modal-pohCsr_x.js → modal-BGXk3f9u.js} +6 -16
- package/dist/{modal-IjDRQfX1.cjs → modal-Cdz9JcCX.cjs} +1 -1
- package/dist/pkt-accordion.cjs +1 -1
- package/dist/pkt-accordion.js +2 -2
- package/dist/pkt-alert.cjs +1 -1
- package/dist/pkt-alert.js +1 -1
- package/dist/pkt-backlink.cjs +1 -1
- package/dist/pkt-backlink.js +1 -1
- package/dist/pkt-button.cjs +1 -1
- package/dist/pkt-button.js +1 -1
- package/dist/pkt-calendar.cjs +1 -1
- package/dist/pkt-calendar.js +1 -1
- package/dist/pkt-card.cjs +1 -1
- package/dist/pkt-card.js +1 -1
- package/dist/pkt-checkbox.cjs +1 -1
- package/dist/pkt-checkbox.js +1 -1
- package/dist/pkt-combobox.cjs +1 -1
- package/dist/pkt-combobox.js +1 -1
- package/dist/pkt-consent.cjs +1 -1
- package/dist/pkt-consent.js +1 -1
- package/dist/pkt-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +8 -4
- package/dist/pkt-heading.cjs +1 -1
- package/dist/pkt-heading.js +1 -1
- package/dist/pkt-helptext.cjs +1 -1
- package/dist/pkt-helptext.js +1 -1
- package/dist/pkt-icon.cjs +1 -1
- package/dist/pkt-icon.js +1 -1
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +29 -29
- package/dist/pkt-input-wrapper.cjs +1 -1
- package/dist/pkt-input-wrapper.js +1 -1
- package/dist/pkt-link.cjs +1 -1
- package/dist/pkt-link.js +1 -1
- package/dist/pkt-linkcard.cjs +1 -1
- package/dist/pkt-linkcard.js +1 -1
- package/dist/pkt-listbox.cjs +1 -1
- package/dist/pkt-listbox.js +1 -1
- package/dist/pkt-loader.cjs +1 -1
- package/dist/pkt-loader.js +1 -1
- package/dist/pkt-messagebox.cjs +1 -1
- package/dist/pkt-messagebox.js +1 -1
- package/dist/pkt-modal.cjs +1 -1
- package/dist/pkt-modal.js +1 -1
- package/dist/pkt-progressbar.cjs +1 -1
- package/dist/pkt-progressbar.js +2 -2
- package/dist/pkt-radiobutton.cjs +1 -1
- package/dist/pkt-radiobutton.js +1 -1
- package/dist/pkt-select.cjs +1 -1
- package/dist/pkt-select.js +1 -1
- package/dist/pkt-tag.cjs +1 -1
- package/dist/pkt-tag.js +1 -1
- package/dist/pkt-textarea.cjs +1 -1
- package/dist/pkt-textarea.js +1 -1
- package/dist/pkt-textinput.cjs +1 -1
- package/dist/pkt-textinput.js +1 -1
- package/dist/{progressbar-DjsupQ7Y.js → progressbar-BbVei20_.js} +7 -7
- package/dist/{progressbar-DJzEC7cx.cjs → progressbar-CazcIzVT.cjs} +2 -2
- package/dist/{radiobutton-DEboKECm.cjs → radiobutton-D1fihs8R.cjs} +1 -1
- package/dist/{radiobutton-Bz_qApF3.js → radiobutton-DODROIBF.js} +5 -5
- package/dist/{ref-BfgcOXko.cjs → ref-BFa5Utho.cjs} +1 -1
- package/dist/{ref-BCGCor-j.js → ref-Xa5dbh--.js} +2 -2
- package/dist/repeat-BZb41H64.cjs +5 -0
- package/dist/{repeat-B6qPUgAq.js → repeat-CJ79egkN.js} +8 -8
- package/dist/{select-DKkoxmgj.js → select-BG2MBQbh.js} +6 -6
- package/dist/{select-DynzsPo0.cjs → select-D-m1PhpA.cjs} +1 -1
- package/dist/{state-CPQXJ4Ct.js → state-DS_kr2Fy.js} +1 -1
- package/dist/{state-BkE_Rxl7.cjs → state-DSjcvzDN.cjs} +1 -1
- package/dist/{tag-NZ5oeGfw.js → tag-CqMgt01I.js} +7 -20
- package/dist/{tag-BKq07hGI.cjs → tag-EFUKrc8q.cjs} +2 -2
- package/dist/{textarea-COG1CH_s.js → textarea-DCKKhs1B.js} +9 -9
- package/dist/{textarea-BS1tgktz.cjs → textarea-aUG3S7C2.cjs} +1 -1
- package/dist/{textinput-CTOtfcTR.js → textinput-B5Ai5R8L.js} +8 -8
- package/dist/{textinput-CCK8ti2y.cjs → textinput-mUERucRy.cjs} +1 -1
- package/package.json +15 -7
- package/src/components/combobox/combobox.ts +1 -1
- package/src/components/datepicker/datepicker-multiple.ts +202 -0
- package/src/components/datepicker/datepicker-range.ts +281 -0
- package/src/components/datepicker/datepicker-single.ts +198 -0
- package/src/components/datepicker/datepicker-utils.ts +9 -1
- package/src/components/datepicker/datepicker.ts +141 -213
- package/src/components/datepicker/index.ts +5 -1
- package/src/components/icon/icon.ts +16 -7
- package/src/components/select/select.ts +1 -1
- package/dist/calendar-DH-fCGyW.cjs +0 -115
- package/dist/class-map-CG3vIaNm.cjs +0 -5
- package/dist/datepicker-C244h82t.cjs +0 -190
- package/dist/datepicker-DwOkktaP.js +0 -859
- package/dist/directive-helpers-_qHew-gi.cjs +0 -5
- package/dist/directive-helpers-cAOIHg9K.js +0 -45
- package/dist/icon-B1-mkmwB.js +0 -88
- package/dist/icon-__Hjt2XZ.cjs +0 -9
- package/dist/input-element-DQOVrqUZ.js +0 -703
- package/dist/input-element-Y8sdrq9C.cjs +0 -1
- package/dist/input-wrapper-8iKEzDRZ.js +0 -40
- package/dist/repeat-DzibMwhi.cjs +0 -5
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { e as
|
|
2
|
-
import { P as
|
|
3
|
-
import { r as
|
|
4
|
-
import "./icon-
|
|
5
|
-
const
|
|
1
|
+
import { e as tt } from "./class-map-wy7PUk0P.js";
|
|
2
|
+
import { P as bt, E as Q, x as D, n as y, a as kt } from "./element-CRDRygXu.js";
|
|
3
|
+
import { r as U } from "./state-DS_kr2Fy.js";
|
|
4
|
+
import "./icon-1dy7UZcu.js";
|
|
5
|
+
const ut = 6048e5, Dt = 864e5, et = Symbol.for("constructDateFrom");
|
|
6
6
|
function v(t, e) {
|
|
7
|
-
return typeof t == "function" ? t(e) : t && typeof t == "object" &&
|
|
7
|
+
return typeof t == "function" ? t(e) : t && typeof t == "object" && et in t ? t[et](e) : t instanceof Date ? new t.constructor(e) : new Date(e);
|
|
8
8
|
}
|
|
9
9
|
function k(t, e) {
|
|
10
10
|
return v(e || t, t);
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function X(t, e, n) {
|
|
13
13
|
const r = k(t, n == null ? void 0 : n.in);
|
|
14
14
|
return isNaN(e) ? v(t, NaN) : (e && r.setDate(r.getDate() + e), r);
|
|
15
15
|
}
|
|
16
|
-
let
|
|
16
|
+
let St = {};
|
|
17
17
|
function L() {
|
|
18
|
-
return
|
|
18
|
+
return St;
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
var o, c,
|
|
22
|
-
const n = L(), r = (e == null ? void 0 : e.weekStartsOn) ?? ((c = (o = e == null ? void 0 : e.locale) == null ? void 0 : o.options) == null ? void 0 : c.weekStartsOn) ?? n.weekStartsOn ?? ((
|
|
20
|
+
function I(t, e) {
|
|
21
|
+
var o, c, l, d;
|
|
22
|
+
const n = L(), r = (e == null ? void 0 : e.weekStartsOn) ?? ((c = (o = e == null ? void 0 : e.locale) == null ? void 0 : o.options) == null ? void 0 : c.weekStartsOn) ?? n.weekStartsOn ?? ((d = (l = n.locale) == null ? void 0 : l.options) == null ? void 0 : d.weekStartsOn) ?? 0, a = k(t, e == null ? void 0 : e.in), s = a.getDay(), i = (s < r ? 7 : 0) + s - r;
|
|
23
23
|
return a.setDate(a.getDate() - i), a.setHours(0, 0, 0, 0), a;
|
|
24
24
|
}
|
|
25
25
|
function q(t, e) {
|
|
26
|
-
return
|
|
26
|
+
return I(t, { ...e, weekStartsOn: 1 });
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function ht(t, e) {
|
|
29
29
|
const n = k(t, e == null ? void 0 : e.in), r = n.getFullYear(), a = v(n, 0);
|
|
30
30
|
a.setFullYear(r + 1, 0, 4), a.setHours(0, 0, 0, 0);
|
|
31
31
|
const s = q(a), i = v(n, 0);
|
|
@@ -33,7 +33,7 @@ function ct(t, e) {
|
|
|
33
33
|
const o = q(i);
|
|
34
34
|
return n.getTime() >= s.getTime() ? r + 1 : n.getTime() >= o.getTime() ? r : r - 1;
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function nt(t) {
|
|
37
37
|
const e = k(t), n = new Date(
|
|
38
38
|
Date.UTC(
|
|
39
39
|
e.getFullYear(),
|
|
@@ -47,41 +47,41 @@ function Z(t) {
|
|
|
47
47
|
);
|
|
48
48
|
return n.setUTCFullYear(e.getFullYear()), +t - +n;
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function dt(t, ...e) {
|
|
51
51
|
const n = v.bind(
|
|
52
52
|
null,
|
|
53
53
|
e.find((r) => typeof r == "object")
|
|
54
54
|
);
|
|
55
55
|
return e.map(n);
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function rt(t, e) {
|
|
58
58
|
const n = k(t, e == null ? void 0 : e.in);
|
|
59
59
|
return n.setHours(0, 0, 0, 0), n;
|
|
60
60
|
}
|
|
61
|
-
function
|
|
62
|
-
const [r, a] =
|
|
61
|
+
function Mt(t, e, n) {
|
|
62
|
+
const [r, a] = dt(
|
|
63
63
|
n == null ? void 0 : n.in,
|
|
64
64
|
t,
|
|
65
65
|
e
|
|
66
|
-
), s =
|
|
67
|
-
return Math.round((o - c) /
|
|
66
|
+
), s = rt(r), i = rt(a), o = +s - nt(s), c = +i - nt(i);
|
|
67
|
+
return Math.round((o - c) / Dt);
|
|
68
68
|
}
|
|
69
|
-
function
|
|
70
|
-
const n =
|
|
69
|
+
function vt(t, e) {
|
|
70
|
+
const n = ht(t, e), r = v(t, 0);
|
|
71
71
|
return r.setFullYear(n, 0, 4), r.setHours(0, 0, 0, 0), q(r);
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function Tt(t) {
|
|
74
74
|
return t instanceof Date || typeof t == "object" && Object.prototype.toString.call(t) === "[object Date]";
|
|
75
75
|
}
|
|
76
|
-
function
|
|
77
|
-
return !(!
|
|
76
|
+
function xt(t) {
|
|
77
|
+
return !(!Tt(t) && typeof t != "number" || isNaN(+k(t)));
|
|
78
78
|
}
|
|
79
|
-
function
|
|
80
|
-
const [n, r] =
|
|
79
|
+
function Ot(t, e) {
|
|
80
|
+
const [n, r] = dt(t, e.start, e.end);
|
|
81
81
|
return { start: n, end: r };
|
|
82
82
|
}
|
|
83
|
-
function
|
|
84
|
-
const { start: n, end: r } =
|
|
83
|
+
function G(t, e) {
|
|
84
|
+
const { start: n, end: r } = Ot(e == null ? void 0 : e.in, t);
|
|
85
85
|
let a = +n > +r;
|
|
86
86
|
const s = a ? +n : +r, i = a ? r : n;
|
|
87
87
|
i.setHours(0, 0, 0, 0);
|
|
@@ -91,11 +91,11 @@ function Q(t, e) {
|
|
|
91
91
|
c.push(v(n, i)), i.setDate(i.getDate() + o), i.setHours(0, 0, 0, 0);
|
|
92
92
|
return a ? c.reverse() : c;
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function Pt(t, e) {
|
|
95
95
|
const n = k(t, e == null ? void 0 : e.in);
|
|
96
96
|
return n.setFullYear(n.getFullYear(), 0, 1), n.setHours(0, 0, 0, 0), n;
|
|
97
97
|
}
|
|
98
|
-
const
|
|
98
|
+
const Nt = {
|
|
99
99
|
lessThanXSeconds: {
|
|
100
100
|
one: "less than a second",
|
|
101
101
|
other: "less than {{count}} seconds"
|
|
@@ -157,54 +157,54 @@ const Tt = {
|
|
|
157
157
|
one: "almost 1 year",
|
|
158
158
|
other: "almost {{count}} years"
|
|
159
159
|
}
|
|
160
|
-
},
|
|
160
|
+
}, $t = (t, e, n) => {
|
|
161
161
|
let r;
|
|
162
|
-
const a =
|
|
162
|
+
const a = Nt[t];
|
|
163
163
|
return typeof a == "string" ? r = a : e === 1 ? r = a.one : r = a.other.replace("{{count}}", e.toString()), n != null && n.addSuffix ? n.comparison && n.comparison > 0 ? "in " + r : r + " ago" : r;
|
|
164
164
|
};
|
|
165
|
-
function
|
|
165
|
+
function V(t) {
|
|
166
166
|
return (e = {}) => {
|
|
167
167
|
const n = e.width ? String(e.width) : t.defaultWidth;
|
|
168
168
|
return t.formats[n] || t.formats[t.defaultWidth];
|
|
169
169
|
};
|
|
170
170
|
}
|
|
171
|
-
const
|
|
171
|
+
const Ct = {
|
|
172
172
|
full: "EEEE, MMMM do, y",
|
|
173
173
|
long: "MMMM do, y",
|
|
174
174
|
medium: "MMM d, y",
|
|
175
175
|
short: "MM/dd/yyyy"
|
|
176
|
-
},
|
|
176
|
+
}, _t = {
|
|
177
177
|
full: "h:mm:ss a zzzz",
|
|
178
178
|
long: "h:mm:ss a z",
|
|
179
179
|
medium: "h:mm:ss a",
|
|
180
180
|
short: "h:mm a"
|
|
181
|
-
},
|
|
181
|
+
}, Et = {
|
|
182
182
|
full: "{{date}} 'at' {{time}}",
|
|
183
183
|
long: "{{date}} 'at' {{time}}",
|
|
184
184
|
medium: "{{date}}, {{time}}",
|
|
185
185
|
short: "{{date}}, {{time}}"
|
|
186
|
-
},
|
|
187
|
-
date:
|
|
188
|
-
formats:
|
|
186
|
+
}, Wt = {
|
|
187
|
+
date: V({
|
|
188
|
+
formats: Ct,
|
|
189
189
|
defaultWidth: "full"
|
|
190
190
|
}),
|
|
191
|
-
time:
|
|
192
|
-
formats:
|
|
191
|
+
time: V({
|
|
192
|
+
formats: _t,
|
|
193
193
|
defaultWidth: "full"
|
|
194
194
|
}),
|
|
195
|
-
dateTime:
|
|
196
|
-
formats:
|
|
195
|
+
dateTime: V({
|
|
196
|
+
formats: Et,
|
|
197
197
|
defaultWidth: "full"
|
|
198
198
|
})
|
|
199
|
-
},
|
|
199
|
+
}, Yt = {
|
|
200
200
|
lastWeek: "'last' eeee 'at' p",
|
|
201
201
|
yesterday: "'yesterday at' p",
|
|
202
202
|
today: "'today at' p",
|
|
203
203
|
tomorrow: "'tomorrow at' p",
|
|
204
204
|
nextWeek: "eeee 'at' p",
|
|
205
205
|
other: "P"
|
|
206
|
-
},
|
|
207
|
-
function
|
|
206
|
+
}, At = (t, e, n, r) => Yt[t];
|
|
207
|
+
function Y(t) {
|
|
208
208
|
return (e, n) => {
|
|
209
209
|
const r = n != null && n.context ? String(n.context) : "standalone";
|
|
210
210
|
let a;
|
|
@@ -219,15 +219,15 @@ function E(t) {
|
|
|
219
219
|
return a[s];
|
|
220
220
|
};
|
|
221
221
|
}
|
|
222
|
-
const
|
|
222
|
+
const Ft = {
|
|
223
223
|
narrow: ["B", "A"],
|
|
224
224
|
abbreviated: ["BC", "AD"],
|
|
225
225
|
wide: ["Before Christ", "Anno Domini"]
|
|
226
|
-
},
|
|
226
|
+
}, Ht = {
|
|
227
227
|
narrow: ["1", "2", "3", "4"],
|
|
228
228
|
abbreviated: ["Q1", "Q2", "Q3", "Q4"],
|
|
229
229
|
wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
|
|
230
|
-
},
|
|
230
|
+
}, It = {
|
|
231
231
|
narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
|
|
232
232
|
abbreviated: [
|
|
233
233
|
"Jan",
|
|
@@ -257,7 +257,7 @@ const Et = {
|
|
|
257
257
|
"November",
|
|
258
258
|
"December"
|
|
259
259
|
]
|
|
260
|
-
},
|
|
260
|
+
}, Rt = {
|
|
261
261
|
narrow: ["S", "M", "T", "W", "T", "F", "S"],
|
|
262
262
|
short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
|
|
263
263
|
abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
|
|
@@ -270,7 +270,7 @@ const Et = {
|
|
|
270
270
|
"Friday",
|
|
271
271
|
"Saturday"
|
|
272
272
|
]
|
|
273
|
-
},
|
|
273
|
+
}, Ut = {
|
|
274
274
|
narrow: {
|
|
275
275
|
am: "a",
|
|
276
276
|
pm: "p",
|
|
@@ -301,7 +301,7 @@ const Et = {
|
|
|
301
301
|
evening: "evening",
|
|
302
302
|
night: "night"
|
|
303
303
|
}
|
|
304
|
-
},
|
|
304
|
+
}, qt = {
|
|
305
305
|
narrow: {
|
|
306
306
|
am: "a",
|
|
307
307
|
pm: "p",
|
|
@@ -332,7 +332,7 @@ const Et = {
|
|
|
332
332
|
evening: "in the evening",
|
|
333
333
|
night: "at night"
|
|
334
334
|
}
|
|
335
|
-
},
|
|
335
|
+
}, Lt = (t, e) => {
|
|
336
336
|
const n = Number(t), r = n % 100;
|
|
337
337
|
if (r > 20 || r < 10)
|
|
338
338
|
switch (r % 10) {
|
|
@@ -344,61 +344,61 @@ const Et = {
|
|
|
344
344
|
return n + "rd";
|
|
345
345
|
}
|
|
346
346
|
return n + "th";
|
|
347
|
-
},
|
|
348
|
-
ordinalNumber:
|
|
349
|
-
era:
|
|
350
|
-
values:
|
|
347
|
+
}, Bt = {
|
|
348
|
+
ordinalNumber: Lt,
|
|
349
|
+
era: Y({
|
|
350
|
+
values: Ft,
|
|
351
351
|
defaultWidth: "wide"
|
|
352
352
|
}),
|
|
353
|
-
quarter:
|
|
354
|
-
values:
|
|
353
|
+
quarter: Y({
|
|
354
|
+
values: Ht,
|
|
355
355
|
defaultWidth: "wide",
|
|
356
356
|
argumentCallback: (t) => t - 1
|
|
357
357
|
}),
|
|
358
|
-
month:
|
|
359
|
-
values:
|
|
358
|
+
month: Y({
|
|
359
|
+
values: It,
|
|
360
360
|
defaultWidth: "wide"
|
|
361
361
|
}),
|
|
362
|
-
day:
|
|
363
|
-
values:
|
|
362
|
+
day: Y({
|
|
363
|
+
values: Rt,
|
|
364
364
|
defaultWidth: "wide"
|
|
365
365
|
}),
|
|
366
|
-
dayPeriod:
|
|
367
|
-
values:
|
|
366
|
+
dayPeriod: Y({
|
|
367
|
+
values: Ut,
|
|
368
368
|
defaultWidth: "wide",
|
|
369
|
-
formattingValues:
|
|
369
|
+
formattingValues: qt,
|
|
370
370
|
defaultFormattingWidth: "wide"
|
|
371
371
|
})
|
|
372
372
|
};
|
|
373
|
-
function
|
|
373
|
+
function A(t) {
|
|
374
374
|
return (e, n = {}) => {
|
|
375
375
|
const r = n.width, a = r && t.matchPatterns[r] || t.matchPatterns[t.defaultMatchWidth], s = e.match(a);
|
|
376
376
|
if (!s)
|
|
377
377
|
return null;
|
|
378
|
-
const i = s[0], o = r && t.parsePatterns[r] || t.parsePatterns[t.defaultParseWidth], c = Array.isArray(o) ?
|
|
378
|
+
const i = s[0], o = r && t.parsePatterns[r] || t.parsePatterns[t.defaultParseWidth], c = Array.isArray(o) ? zt(o, (m) => m.test(i)) : (
|
|
379
379
|
// [TODO] -- I challenge you to fix the type
|
|
380
|
-
|
|
380
|
+
jt(o, (m) => m.test(i))
|
|
381
381
|
);
|
|
382
|
-
let
|
|
383
|
-
|
|
382
|
+
let l;
|
|
383
|
+
l = t.valueCallback ? t.valueCallback(c) : c, l = n.valueCallback ? (
|
|
384
384
|
// [TODO] -- I challenge you to fix the type
|
|
385
|
-
n.valueCallback(
|
|
386
|
-
) :
|
|
387
|
-
const
|
|
388
|
-
return { value:
|
|
385
|
+
n.valueCallback(l)
|
|
386
|
+
) : l;
|
|
387
|
+
const d = e.slice(i.length);
|
|
388
|
+
return { value: l, rest: d };
|
|
389
389
|
};
|
|
390
390
|
}
|
|
391
|
-
function
|
|
391
|
+
function jt(t, e) {
|
|
392
392
|
for (const n in t)
|
|
393
393
|
if (Object.prototype.hasOwnProperty.call(t, n) && e(t[n]))
|
|
394
394
|
return n;
|
|
395
395
|
}
|
|
396
|
-
function
|
|
396
|
+
function zt(t, e) {
|
|
397
397
|
for (let n = 0; n < t.length; n++)
|
|
398
398
|
if (e(t[n]))
|
|
399
399
|
return n;
|
|
400
400
|
}
|
|
401
|
-
function
|
|
401
|
+
function Qt(t) {
|
|
402
402
|
return (e, n = {}) => {
|
|
403
403
|
const r = e.match(t.matchPattern);
|
|
404
404
|
if (!r) return null;
|
|
@@ -410,23 +410,23 @@ function Ut(t) {
|
|
|
410
410
|
return { value: i, rest: o };
|
|
411
411
|
};
|
|
412
412
|
}
|
|
413
|
-
const
|
|
413
|
+
const Xt = /^(\d+)(th|st|nd|rd)?/i, Gt = /\d+/i, Vt = {
|
|
414
414
|
narrow: /^(b|a)/i,
|
|
415
415
|
abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
|
|
416
416
|
wide: /^(before christ|before common era|anno domini|common era)/i
|
|
417
|
-
},
|
|
417
|
+
}, Jt = {
|
|
418
418
|
any: [/^b/i, /^(a|c)/i]
|
|
419
|
-
},
|
|
419
|
+
}, Kt = {
|
|
420
420
|
narrow: /^[1234]/i,
|
|
421
421
|
abbreviated: /^q[1234]/i,
|
|
422
422
|
wide: /^[1234](th|st|nd|rd)? quarter/i
|
|
423
|
-
},
|
|
423
|
+
}, Zt = {
|
|
424
424
|
any: [/1/i, /2/i, /3/i, /4/i]
|
|
425
|
-
},
|
|
425
|
+
}, te = {
|
|
426
426
|
narrow: /^[jfmasond]/i,
|
|
427
427
|
abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
|
|
428
428
|
wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
|
|
429
|
-
},
|
|
429
|
+
}, ee = {
|
|
430
430
|
narrow: [
|
|
431
431
|
/^j/i,
|
|
432
432
|
/^f/i,
|
|
@@ -455,18 +455,18 @@ const Bt = /^(\d+)(th|st|nd|rd)?/i, zt = /\d+/i, jt = {
|
|
|
455
455
|
/^n/i,
|
|
456
456
|
/^d/i
|
|
457
457
|
]
|
|
458
|
-
},
|
|
458
|
+
}, ne = {
|
|
459
459
|
narrow: /^[smtwf]/i,
|
|
460
460
|
short: /^(su|mo|tu|we|th|fr|sa)/i,
|
|
461
461
|
abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
|
|
462
462
|
wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
|
|
463
|
-
},
|
|
463
|
+
}, re = {
|
|
464
464
|
narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
|
|
465
465
|
any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
|
|
466
|
-
},
|
|
466
|
+
}, ae = {
|
|
467
467
|
narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
|
|
468
468
|
any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
|
|
469
|
-
},
|
|
469
|
+
}, se = {
|
|
470
470
|
any: {
|
|
471
471
|
am: /^a/i,
|
|
472
472
|
pm: /^p/i,
|
|
@@ -477,82 +477,82 @@ const Bt = /^(\d+)(th|st|nd|rd)?/i, zt = /\d+/i, jt = {
|
|
|
477
477
|
evening: /evening/i,
|
|
478
478
|
night: /night/i
|
|
479
479
|
}
|
|
480
|
-
},
|
|
481
|
-
ordinalNumber:
|
|
482
|
-
matchPattern:
|
|
483
|
-
parsePattern:
|
|
480
|
+
}, ie = {
|
|
481
|
+
ordinalNumber: Qt({
|
|
482
|
+
matchPattern: Xt,
|
|
483
|
+
parsePattern: Gt,
|
|
484
484
|
valueCallback: (t) => parseInt(t, 10)
|
|
485
485
|
}),
|
|
486
|
-
era:
|
|
487
|
-
matchPatterns:
|
|
486
|
+
era: A({
|
|
487
|
+
matchPatterns: Vt,
|
|
488
488
|
defaultMatchWidth: "wide",
|
|
489
|
-
parsePatterns:
|
|
489
|
+
parsePatterns: Jt,
|
|
490
490
|
defaultParseWidth: "any"
|
|
491
491
|
}),
|
|
492
|
-
quarter:
|
|
493
|
-
matchPatterns:
|
|
492
|
+
quarter: A({
|
|
493
|
+
matchPatterns: Kt,
|
|
494
494
|
defaultMatchWidth: "wide",
|
|
495
|
-
parsePatterns:
|
|
495
|
+
parsePatterns: Zt,
|
|
496
496
|
defaultParseWidth: "any",
|
|
497
497
|
valueCallback: (t) => t + 1
|
|
498
498
|
}),
|
|
499
|
-
month:
|
|
500
|
-
matchPatterns:
|
|
499
|
+
month: A({
|
|
500
|
+
matchPatterns: te,
|
|
501
501
|
defaultMatchWidth: "wide",
|
|
502
|
-
parsePatterns:
|
|
502
|
+
parsePatterns: ee,
|
|
503
503
|
defaultParseWidth: "any"
|
|
504
504
|
}),
|
|
505
|
-
day:
|
|
506
|
-
matchPatterns:
|
|
505
|
+
day: A({
|
|
506
|
+
matchPatterns: ne,
|
|
507
507
|
defaultMatchWidth: "wide",
|
|
508
|
-
parsePatterns:
|
|
508
|
+
parsePatterns: re,
|
|
509
509
|
defaultParseWidth: "any"
|
|
510
510
|
}),
|
|
511
|
-
dayPeriod:
|
|
512
|
-
matchPatterns:
|
|
511
|
+
dayPeriod: A({
|
|
512
|
+
matchPatterns: ae,
|
|
513
513
|
defaultMatchWidth: "any",
|
|
514
|
-
parsePatterns:
|
|
514
|
+
parsePatterns: se,
|
|
515
515
|
defaultParseWidth: "any"
|
|
516
516
|
})
|
|
517
|
-
},
|
|
517
|
+
}, oe = {
|
|
518
518
|
code: "en-US",
|
|
519
|
-
formatDistance:
|
|
520
|
-
formatLong:
|
|
521
|
-
formatRelative:
|
|
522
|
-
localize:
|
|
523
|
-
match:
|
|
519
|
+
formatDistance: $t,
|
|
520
|
+
formatLong: Wt,
|
|
521
|
+
formatRelative: At,
|
|
522
|
+
localize: Bt,
|
|
523
|
+
match: ie,
|
|
524
524
|
options: {
|
|
525
525
|
weekStartsOn: 0,
|
|
526
526
|
firstWeekContainsDate: 1
|
|
527
527
|
}
|
|
528
528
|
};
|
|
529
|
-
function
|
|
529
|
+
function ce(t, e) {
|
|
530
530
|
const n = k(t, e == null ? void 0 : e.in);
|
|
531
|
-
return
|
|
531
|
+
return Mt(n, Pt(n)) + 1;
|
|
532
532
|
}
|
|
533
|
-
function
|
|
534
|
-
const n = k(t, e == null ? void 0 : e.in), r = +q(n) - +
|
|
535
|
-
return Math.round(r /
|
|
533
|
+
function le(t, e) {
|
|
534
|
+
const n = k(t, e == null ? void 0 : e.in), r = +q(n) - +vt(n);
|
|
535
|
+
return Math.round(r / ut) + 1;
|
|
536
536
|
}
|
|
537
|
-
function
|
|
538
|
-
var
|
|
539
|
-
const n = k(t, e == null ? void 0 : e.in), r = n.getFullYear(), a = L(), s = (e == null ? void 0 : e.firstWeekContainsDate) ?? ((
|
|
537
|
+
function ft(t, e) {
|
|
538
|
+
var d, m, g, S;
|
|
539
|
+
const n = k(t, e == null ? void 0 : e.in), r = n.getFullYear(), a = L(), s = (e == null ? void 0 : e.firstWeekContainsDate) ?? ((m = (d = e == null ? void 0 : e.locale) == null ? void 0 : d.options) == null ? void 0 : m.firstWeekContainsDate) ?? a.firstWeekContainsDate ?? ((S = (g = a.locale) == null ? void 0 : g.options) == null ? void 0 : S.firstWeekContainsDate) ?? 1, i = v((e == null ? void 0 : e.in) || t, 0);
|
|
540
540
|
i.setFullYear(r + 1, 0, s), i.setHours(0, 0, 0, 0);
|
|
541
|
-
const o =
|
|
541
|
+
const o = I(i, e), c = v((e == null ? void 0 : e.in) || t, 0);
|
|
542
542
|
c.setFullYear(r, 0, s), c.setHours(0, 0, 0, 0);
|
|
543
|
-
const
|
|
544
|
-
return +n >= +o ? r + 1 : +n >= +
|
|
543
|
+
const l = I(c, e);
|
|
544
|
+
return +n >= +o ? r + 1 : +n >= +l ? r : r - 1;
|
|
545
545
|
}
|
|
546
|
-
function
|
|
547
|
-
var o, c,
|
|
548
|
-
const n = L(), r = (e == null ? void 0 : e.firstWeekContainsDate) ?? ((c = (o = e == null ? void 0 : e.locale) == null ? void 0 : o.options) == null ? void 0 : c.firstWeekContainsDate) ?? n.firstWeekContainsDate ?? ((
|
|
549
|
-
return s.setFullYear(a, 0, r), s.setHours(0, 0, 0, 0),
|
|
546
|
+
function ue(t, e) {
|
|
547
|
+
var o, c, l, d;
|
|
548
|
+
const n = L(), r = (e == null ? void 0 : e.firstWeekContainsDate) ?? ((c = (o = e == null ? void 0 : e.locale) == null ? void 0 : o.options) == null ? void 0 : c.firstWeekContainsDate) ?? n.firstWeekContainsDate ?? ((d = (l = n.locale) == null ? void 0 : l.options) == null ? void 0 : d.firstWeekContainsDate) ?? 1, a = ft(t, e), s = v((e == null ? void 0 : e.in) || t, 0);
|
|
549
|
+
return s.setFullYear(a, 0, r), s.setHours(0, 0, 0, 0), I(s, e);
|
|
550
550
|
}
|
|
551
|
-
function
|
|
552
|
-
const n = k(t, e == null ? void 0 : e.in), r = +
|
|
553
|
-
return Math.round(r /
|
|
551
|
+
function mt(t, e) {
|
|
552
|
+
const n = k(t, e == null ? void 0 : e.in), r = +I(n, e) - +ue(n, e);
|
|
553
|
+
return Math.round(r / ut) + 1;
|
|
554
554
|
}
|
|
555
|
-
function
|
|
555
|
+
function u(t, e) {
|
|
556
556
|
const n = t < 0 ? "-" : "", r = Math.abs(t).toString().padStart(e, "0");
|
|
557
557
|
return n + r;
|
|
558
558
|
}
|
|
@@ -560,16 +560,16 @@ const T = {
|
|
|
560
560
|
// Year
|
|
561
561
|
y(t, e) {
|
|
562
562
|
const n = t.getFullYear(), r = n > 0 ? n : 1 - n;
|
|
563
|
-
return
|
|
563
|
+
return u(e === "yy" ? r % 100 : r, e.length);
|
|
564
564
|
},
|
|
565
565
|
// Month
|
|
566
566
|
M(t, e) {
|
|
567
567
|
const n = t.getMonth();
|
|
568
|
-
return e === "M" ? String(n + 1) :
|
|
568
|
+
return e === "M" ? String(n + 1) : u(n + 1, 2);
|
|
569
569
|
},
|
|
570
570
|
// Day of the month
|
|
571
571
|
d(t, e) {
|
|
572
|
-
return
|
|
572
|
+
return u(t.getDate(), e.length);
|
|
573
573
|
},
|
|
574
574
|
// AM or PM
|
|
575
575
|
a(t, e) {
|
|
@@ -589,45 +589,48 @@ const T = {
|
|
|
589
589
|
},
|
|
590
590
|
// Hour [1-12]
|
|
591
591
|
h(t, e) {
|
|
592
|
-
return
|
|
592
|
+
return u(t.getHours() % 12 || 12, e.length);
|
|
593
593
|
},
|
|
594
594
|
// Hour [0-23]
|
|
595
595
|
H(t, e) {
|
|
596
|
-
return
|
|
596
|
+
return u(t.getHours(), e.length);
|
|
597
597
|
},
|
|
598
598
|
// Minute
|
|
599
599
|
m(t, e) {
|
|
600
|
-
return
|
|
600
|
+
return u(t.getMinutes(), e.length);
|
|
601
601
|
},
|
|
602
602
|
// Second
|
|
603
603
|
s(t, e) {
|
|
604
|
-
return
|
|
604
|
+
return u(t.getSeconds(), e.length);
|
|
605
605
|
},
|
|
606
606
|
// Fraction of second
|
|
607
607
|
S(t, e) {
|
|
608
608
|
const n = e.length, r = t.getMilliseconds(), a = Math.trunc(
|
|
609
609
|
r * Math.pow(10, n - 3)
|
|
610
610
|
);
|
|
611
|
-
return
|
|
611
|
+
return u(a, e.length);
|
|
612
612
|
}
|
|
613
|
-
},
|
|
613
|
+
}, _ = {
|
|
614
614
|
midnight: "midnight",
|
|
615
615
|
noon: "noon",
|
|
616
616
|
morning: "morning",
|
|
617
617
|
afternoon: "afternoon",
|
|
618
618
|
evening: "evening",
|
|
619
619
|
night: "night"
|
|
620
|
-
},
|
|
620
|
+
}, at = {
|
|
621
621
|
// Era
|
|
622
622
|
G: function(t, e, n) {
|
|
623
623
|
const r = t.getFullYear() > 0 ? 1 : 0;
|
|
624
624
|
switch (e) {
|
|
625
|
+
// AD, BC
|
|
625
626
|
case "G":
|
|
626
627
|
case "GG":
|
|
627
628
|
case "GGG":
|
|
628
629
|
return n.era(r, { width: "abbreviated" });
|
|
630
|
+
// A, B
|
|
629
631
|
case "GGGGG":
|
|
630
632
|
return n.era(r, { width: "narrow" });
|
|
633
|
+
// Anno Domini, Before Christ
|
|
631
634
|
case "GGGG":
|
|
632
635
|
default:
|
|
633
636
|
return n.era(r, { width: "wide" });
|
|
@@ -643,17 +646,17 @@ const T = {
|
|
|
643
646
|
},
|
|
644
647
|
// Local week-numbering year
|
|
645
648
|
Y: function(t, e, n, r) {
|
|
646
|
-
const a =
|
|
649
|
+
const a = ft(t, r), s = a > 0 ? a : 1 - a;
|
|
647
650
|
if (e === "YY") {
|
|
648
651
|
const i = s % 100;
|
|
649
|
-
return
|
|
652
|
+
return u(i, 2);
|
|
650
653
|
}
|
|
651
|
-
return e === "Yo" ? n.ordinalNumber(s, { unit: "year" }) :
|
|
654
|
+
return e === "Yo" ? n.ordinalNumber(s, { unit: "year" }) : u(s, e.length);
|
|
652
655
|
},
|
|
653
656
|
// ISO week-numbering year
|
|
654
657
|
R: function(t, e) {
|
|
655
|
-
const n =
|
|
656
|
-
return
|
|
658
|
+
const n = ht(t);
|
|
659
|
+
return u(n, e.length);
|
|
657
660
|
},
|
|
658
661
|
// Extended year. This is a single number designating the year of this calendar system.
|
|
659
662
|
// The main difference between `y` and `u` localizers are B.C. years:
|
|
@@ -666,28 +669,34 @@ const T = {
|
|
|
666
669
|
// while `uu` pads single digit years to 2 characters and returns other years unchanged.
|
|
667
670
|
u: function(t, e) {
|
|
668
671
|
const n = t.getFullYear();
|
|
669
|
-
return
|
|
672
|
+
return u(n, e.length);
|
|
670
673
|
},
|
|
671
674
|
// Quarter
|
|
672
675
|
Q: function(t, e, n) {
|
|
673
676
|
const r = Math.ceil((t.getMonth() + 1) / 3);
|
|
674
677
|
switch (e) {
|
|
678
|
+
// 1, 2, 3, 4
|
|
675
679
|
case "Q":
|
|
676
680
|
return String(r);
|
|
681
|
+
// 01, 02, 03, 04
|
|
677
682
|
case "QQ":
|
|
678
|
-
return
|
|
683
|
+
return u(r, 2);
|
|
684
|
+
// 1st, 2nd, 3rd, 4th
|
|
679
685
|
case "Qo":
|
|
680
686
|
return n.ordinalNumber(r, { unit: "quarter" });
|
|
687
|
+
// Q1, Q2, Q3, Q4
|
|
681
688
|
case "QQQ":
|
|
682
689
|
return n.quarter(r, {
|
|
683
690
|
width: "abbreviated",
|
|
684
691
|
context: "formatting"
|
|
685
692
|
});
|
|
693
|
+
// 1, 2, 3, 4 (narrow quarter; could be not numerical)
|
|
686
694
|
case "QQQQQ":
|
|
687
695
|
return n.quarter(r, {
|
|
688
696
|
width: "narrow",
|
|
689
697
|
context: "formatting"
|
|
690
698
|
});
|
|
699
|
+
// 1st quarter, 2nd quarter, ...
|
|
691
700
|
case "QQQQ":
|
|
692
701
|
default:
|
|
693
702
|
return n.quarter(r, {
|
|
@@ -700,22 +709,28 @@ const T = {
|
|
|
700
709
|
q: function(t, e, n) {
|
|
701
710
|
const r = Math.ceil((t.getMonth() + 1) / 3);
|
|
702
711
|
switch (e) {
|
|
712
|
+
// 1, 2, 3, 4
|
|
703
713
|
case "q":
|
|
704
714
|
return String(r);
|
|
715
|
+
// 01, 02, 03, 04
|
|
705
716
|
case "qq":
|
|
706
|
-
return
|
|
717
|
+
return u(r, 2);
|
|
718
|
+
// 1st, 2nd, 3rd, 4th
|
|
707
719
|
case "qo":
|
|
708
720
|
return n.ordinalNumber(r, { unit: "quarter" });
|
|
721
|
+
// Q1, Q2, Q3, Q4
|
|
709
722
|
case "qqq":
|
|
710
723
|
return n.quarter(r, {
|
|
711
724
|
width: "abbreviated",
|
|
712
725
|
context: "standalone"
|
|
713
726
|
});
|
|
727
|
+
// 1, 2, 3, 4 (narrow quarter; could be not numerical)
|
|
714
728
|
case "qqqqq":
|
|
715
729
|
return n.quarter(r, {
|
|
716
730
|
width: "narrow",
|
|
717
731
|
context: "standalone"
|
|
718
732
|
});
|
|
733
|
+
// 1st quarter, 2nd quarter, ...
|
|
719
734
|
case "qqqq":
|
|
720
735
|
default:
|
|
721
736
|
return n.quarter(r, {
|
|
@@ -731,18 +746,22 @@ const T = {
|
|
|
731
746
|
case "M":
|
|
732
747
|
case "MM":
|
|
733
748
|
return T.M(t, e);
|
|
749
|
+
// 1st, 2nd, ..., 12th
|
|
734
750
|
case "Mo":
|
|
735
751
|
return n.ordinalNumber(r + 1, { unit: "month" });
|
|
752
|
+
// Jan, Feb, ..., Dec
|
|
736
753
|
case "MMM":
|
|
737
754
|
return n.month(r, {
|
|
738
755
|
width: "abbreviated",
|
|
739
756
|
context: "formatting"
|
|
740
757
|
});
|
|
758
|
+
// J, F, ..., D
|
|
741
759
|
case "MMMMM":
|
|
742
760
|
return n.month(r, {
|
|
743
761
|
width: "narrow",
|
|
744
762
|
context: "formatting"
|
|
745
763
|
});
|
|
764
|
+
// January, February, ..., December
|
|
746
765
|
case "MMMM":
|
|
747
766
|
default:
|
|
748
767
|
return n.month(r, { width: "wide", context: "formatting" });
|
|
@@ -752,22 +771,28 @@ const T = {
|
|
|
752
771
|
L: function(t, e, n) {
|
|
753
772
|
const r = t.getMonth();
|
|
754
773
|
switch (e) {
|
|
774
|
+
// 1, 2, ..., 12
|
|
755
775
|
case "L":
|
|
756
776
|
return String(r + 1);
|
|
777
|
+
// 01, 02, ..., 12
|
|
757
778
|
case "LL":
|
|
758
|
-
return
|
|
779
|
+
return u(r + 1, 2);
|
|
780
|
+
// 1st, 2nd, ..., 12th
|
|
759
781
|
case "Lo":
|
|
760
782
|
return n.ordinalNumber(r + 1, { unit: "month" });
|
|
783
|
+
// Jan, Feb, ..., Dec
|
|
761
784
|
case "LLL":
|
|
762
785
|
return n.month(r, {
|
|
763
786
|
width: "abbreviated",
|
|
764
787
|
context: "standalone"
|
|
765
788
|
});
|
|
789
|
+
// J, F, ..., D
|
|
766
790
|
case "LLLLL":
|
|
767
791
|
return n.month(r, {
|
|
768
792
|
width: "narrow",
|
|
769
793
|
context: "standalone"
|
|
770
794
|
});
|
|
795
|
+
// January, February, ..., December
|
|
771
796
|
case "LLLL":
|
|
772
797
|
default:
|
|
773
798
|
return n.month(r, { width: "wide", context: "standalone" });
|
|
@@ -775,13 +800,13 @@ const T = {
|
|
|
775
800
|
},
|
|
776
801
|
// Local week of year
|
|
777
802
|
w: function(t, e, n, r) {
|
|
778
|
-
const a =
|
|
779
|
-
return e === "wo" ? n.ordinalNumber(a, { unit: "week" }) :
|
|
803
|
+
const a = mt(t, r);
|
|
804
|
+
return e === "wo" ? n.ordinalNumber(a, { unit: "week" }) : u(a, e.length);
|
|
780
805
|
},
|
|
781
806
|
// ISO week of year
|
|
782
807
|
I: function(t, e, n) {
|
|
783
|
-
const r =
|
|
784
|
-
return e === "Io" ? n.ordinalNumber(r, { unit: "week" }) :
|
|
808
|
+
const r = le(t);
|
|
809
|
+
return e === "Io" ? n.ordinalNumber(r, { unit: "week" }) : u(r, e.length);
|
|
785
810
|
},
|
|
786
811
|
// Day of the month
|
|
787
812
|
d: function(t, e, n) {
|
|
@@ -789,13 +814,14 @@ const T = {
|
|
|
789
814
|
},
|
|
790
815
|
// Day of year
|
|
791
816
|
D: function(t, e, n) {
|
|
792
|
-
const r =
|
|
793
|
-
return e === "Do" ? n.ordinalNumber(r, { unit: "dayOfYear" }) :
|
|
817
|
+
const r = ce(t);
|
|
818
|
+
return e === "Do" ? n.ordinalNumber(r, { unit: "dayOfYear" }) : u(r, e.length);
|
|
794
819
|
},
|
|
795
820
|
// Day of week
|
|
796
821
|
E: function(t, e, n) {
|
|
797
822
|
const r = t.getDay();
|
|
798
823
|
switch (e) {
|
|
824
|
+
// Tue
|
|
799
825
|
case "E":
|
|
800
826
|
case "EE":
|
|
801
827
|
case "EEE":
|
|
@@ -803,16 +829,19 @@ const T = {
|
|
|
803
829
|
width: "abbreviated",
|
|
804
830
|
context: "formatting"
|
|
805
831
|
});
|
|
832
|
+
// T
|
|
806
833
|
case "EEEEE":
|
|
807
834
|
return n.day(r, {
|
|
808
835
|
width: "narrow",
|
|
809
836
|
context: "formatting"
|
|
810
837
|
});
|
|
838
|
+
// Tu
|
|
811
839
|
case "EEEEEE":
|
|
812
840
|
return n.day(r, {
|
|
813
841
|
width: "short",
|
|
814
842
|
context: "formatting"
|
|
815
843
|
});
|
|
844
|
+
// Tuesday
|
|
816
845
|
case "EEEE":
|
|
817
846
|
default:
|
|
818
847
|
return n.day(r, {
|
|
@@ -825,10 +854,13 @@ const T = {
|
|
|
825
854
|
e: function(t, e, n, r) {
|
|
826
855
|
const a = t.getDay(), s = (a - r.weekStartsOn + 8) % 7 || 7;
|
|
827
856
|
switch (e) {
|
|
857
|
+
// Numerical value (Nth day of week with current locale or weekStartsOn)
|
|
828
858
|
case "e":
|
|
829
859
|
return String(s);
|
|
860
|
+
// Padded numerical value
|
|
830
861
|
case "ee":
|
|
831
|
-
return
|
|
862
|
+
return u(s, 2);
|
|
863
|
+
// 1st, 2nd, ..., 7th
|
|
832
864
|
case "eo":
|
|
833
865
|
return n.ordinalNumber(s, { unit: "day" });
|
|
834
866
|
case "eee":
|
|
@@ -836,16 +868,19 @@ const T = {
|
|
|
836
868
|
width: "abbreviated",
|
|
837
869
|
context: "formatting"
|
|
838
870
|
});
|
|
871
|
+
// T
|
|
839
872
|
case "eeeee":
|
|
840
873
|
return n.day(a, {
|
|
841
874
|
width: "narrow",
|
|
842
875
|
context: "formatting"
|
|
843
876
|
});
|
|
877
|
+
// Tu
|
|
844
878
|
case "eeeeee":
|
|
845
879
|
return n.day(a, {
|
|
846
880
|
width: "short",
|
|
847
881
|
context: "formatting"
|
|
848
882
|
});
|
|
883
|
+
// Tuesday
|
|
849
884
|
case "eeee":
|
|
850
885
|
default:
|
|
851
886
|
return n.day(a, {
|
|
@@ -858,10 +893,13 @@ const T = {
|
|
|
858
893
|
c: function(t, e, n, r) {
|
|
859
894
|
const a = t.getDay(), s = (a - r.weekStartsOn + 8) % 7 || 7;
|
|
860
895
|
switch (e) {
|
|
896
|
+
// Numerical value (same as in `e`)
|
|
861
897
|
case "c":
|
|
862
898
|
return String(s);
|
|
899
|
+
// Padded numerical value
|
|
863
900
|
case "cc":
|
|
864
|
-
return
|
|
901
|
+
return u(s, e.length);
|
|
902
|
+
// 1st, 2nd, ..., 7th
|
|
865
903
|
case "co":
|
|
866
904
|
return n.ordinalNumber(s, { unit: "day" });
|
|
867
905
|
case "ccc":
|
|
@@ -869,16 +907,19 @@ const T = {
|
|
|
869
907
|
width: "abbreviated",
|
|
870
908
|
context: "standalone"
|
|
871
909
|
});
|
|
910
|
+
// T
|
|
872
911
|
case "ccccc":
|
|
873
912
|
return n.day(a, {
|
|
874
913
|
width: "narrow",
|
|
875
914
|
context: "standalone"
|
|
876
915
|
});
|
|
916
|
+
// Tu
|
|
877
917
|
case "cccccc":
|
|
878
918
|
return n.day(a, {
|
|
879
919
|
width: "short",
|
|
880
920
|
context: "standalone"
|
|
881
921
|
});
|
|
922
|
+
// Tuesday
|
|
882
923
|
case "cccc":
|
|
883
924
|
default:
|
|
884
925
|
return n.day(a, {
|
|
@@ -891,27 +932,34 @@ const T = {
|
|
|
891
932
|
i: function(t, e, n) {
|
|
892
933
|
const r = t.getDay(), a = r === 0 ? 7 : r;
|
|
893
934
|
switch (e) {
|
|
935
|
+
// 2
|
|
894
936
|
case "i":
|
|
895
937
|
return String(a);
|
|
938
|
+
// 02
|
|
896
939
|
case "ii":
|
|
897
|
-
return
|
|
940
|
+
return u(a, e.length);
|
|
941
|
+
// 2nd
|
|
898
942
|
case "io":
|
|
899
943
|
return n.ordinalNumber(a, { unit: "day" });
|
|
944
|
+
// Tue
|
|
900
945
|
case "iii":
|
|
901
946
|
return n.day(r, {
|
|
902
947
|
width: "abbreviated",
|
|
903
948
|
context: "formatting"
|
|
904
949
|
});
|
|
950
|
+
// T
|
|
905
951
|
case "iiiii":
|
|
906
952
|
return n.day(r, {
|
|
907
953
|
width: "narrow",
|
|
908
954
|
context: "formatting"
|
|
909
955
|
});
|
|
956
|
+
// Tu
|
|
910
957
|
case "iiiiii":
|
|
911
958
|
return n.day(r, {
|
|
912
959
|
width: "short",
|
|
913
960
|
context: "formatting"
|
|
914
961
|
});
|
|
962
|
+
// Tuesday
|
|
915
963
|
case "iiii":
|
|
916
964
|
default:
|
|
917
965
|
return n.day(r, {
|
|
@@ -952,7 +1000,7 @@ const T = {
|
|
|
952
1000
|
b: function(t, e, n) {
|
|
953
1001
|
const r = t.getHours();
|
|
954
1002
|
let a;
|
|
955
|
-
switch (r === 12 ? a =
|
|
1003
|
+
switch (r === 12 ? a = _.noon : r === 0 ? a = _.midnight : a = r / 12 >= 1 ? "pm" : "am", e) {
|
|
956
1004
|
case "b":
|
|
957
1005
|
case "bb":
|
|
958
1006
|
return n.dayPeriod(a, {
|
|
@@ -981,7 +1029,7 @@ const T = {
|
|
|
981
1029
|
B: function(t, e, n) {
|
|
982
1030
|
const r = t.getHours();
|
|
983
1031
|
let a;
|
|
984
|
-
switch (r >= 17 ? a =
|
|
1032
|
+
switch (r >= 17 ? a = _.evening : r >= 12 ? a = _.afternoon : r >= 4 ? a = _.morning : a = _.night, e) {
|
|
985
1033
|
case "B":
|
|
986
1034
|
case "BB":
|
|
987
1035
|
case "BBB":
|
|
@@ -1017,12 +1065,12 @@ const T = {
|
|
|
1017
1065
|
// Hour [0-11]
|
|
1018
1066
|
K: function(t, e, n) {
|
|
1019
1067
|
const r = t.getHours() % 12;
|
|
1020
|
-
return e === "Ko" ? n.ordinalNumber(r, { unit: "hour" }) :
|
|
1068
|
+
return e === "Ko" ? n.ordinalNumber(r, { unit: "hour" }) : u(r, e.length);
|
|
1021
1069
|
},
|
|
1022
1070
|
// Hour [1-24]
|
|
1023
1071
|
k: function(t, e, n) {
|
|
1024
1072
|
let r = t.getHours();
|
|
1025
|
-
return r === 0 && (r = 24), e === "ko" ? n.ordinalNumber(r, { unit: "hour" }) :
|
|
1073
|
+
return r === 0 && (r = 24), e === "ko" ? n.ordinalNumber(r, { unit: "hour" }) : u(r, e.length);
|
|
1026
1074
|
},
|
|
1027
1075
|
// Minute
|
|
1028
1076
|
m: function(t, e, n) {
|
|
@@ -1042,13 +1090,21 @@ const T = {
|
|
|
1042
1090
|
if (r === 0)
|
|
1043
1091
|
return "Z";
|
|
1044
1092
|
switch (e) {
|
|
1093
|
+
// Hours and optional minutes
|
|
1045
1094
|
case "X":
|
|
1046
|
-
return
|
|
1095
|
+
return it(r);
|
|
1096
|
+
// Hours, minutes and optional seconds without `:` delimiter
|
|
1097
|
+
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
1098
|
+
// so this token always has the same output as `XX`
|
|
1047
1099
|
case "XXXX":
|
|
1048
1100
|
case "XX":
|
|
1049
1101
|
return N(r);
|
|
1102
|
+
// Hours, minutes and optional seconds with `:` delimiter
|
|
1103
|
+
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
1104
|
+
// so this token always has the same output as `XXX`
|
|
1050
1105
|
case "XXXXX":
|
|
1051
1106
|
case "XXX":
|
|
1107
|
+
// Hours and minutes with `:` delimiter
|
|
1052
1108
|
default:
|
|
1053
1109
|
return N(r, ":");
|
|
1054
1110
|
}
|
|
@@ -1057,13 +1113,21 @@ const T = {
|
|
|
1057
1113
|
x: function(t, e, n) {
|
|
1058
1114
|
const r = t.getTimezoneOffset();
|
|
1059
1115
|
switch (e) {
|
|
1116
|
+
// Hours and optional minutes
|
|
1060
1117
|
case "x":
|
|
1061
|
-
return
|
|
1118
|
+
return it(r);
|
|
1119
|
+
// Hours, minutes and optional seconds without `:` delimiter
|
|
1120
|
+
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
1121
|
+
// so this token always has the same output as `xx`
|
|
1062
1122
|
case "xxxx":
|
|
1063
1123
|
case "xx":
|
|
1064
1124
|
return N(r);
|
|
1125
|
+
// Hours, minutes and optional seconds with `:` delimiter
|
|
1126
|
+
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
1127
|
+
// so this token always has the same output as `xxx`
|
|
1065
1128
|
case "xxxxx":
|
|
1066
1129
|
case "xxx":
|
|
1130
|
+
// Hours and minutes with `:` delimiter
|
|
1067
1131
|
default:
|
|
1068
1132
|
return N(r, ":");
|
|
1069
1133
|
}
|
|
@@ -1072,10 +1136,12 @@ const T = {
|
|
|
1072
1136
|
O: function(t, e, n) {
|
|
1073
1137
|
const r = t.getTimezoneOffset();
|
|
1074
1138
|
switch (e) {
|
|
1139
|
+
// Short
|
|
1075
1140
|
case "O":
|
|
1076
1141
|
case "OO":
|
|
1077
1142
|
case "OOO":
|
|
1078
|
-
return "GMT" +
|
|
1143
|
+
return "GMT" + st(r, ":");
|
|
1144
|
+
// Long
|
|
1079
1145
|
case "OOOO":
|
|
1080
1146
|
default:
|
|
1081
1147
|
return "GMT" + N(r, ":");
|
|
@@ -1085,10 +1151,12 @@ const T = {
|
|
|
1085
1151
|
z: function(t, e, n) {
|
|
1086
1152
|
const r = t.getTimezoneOffset();
|
|
1087
1153
|
switch (e) {
|
|
1154
|
+
// Short
|
|
1088
1155
|
case "z":
|
|
1089
1156
|
case "zz":
|
|
1090
1157
|
case "zzz":
|
|
1091
|
-
return "GMT" +
|
|
1158
|
+
return "GMT" + st(r, ":");
|
|
1159
|
+
// Long
|
|
1092
1160
|
case "zzzz":
|
|
1093
1161
|
default:
|
|
1094
1162
|
return "GMT" + N(r, ":");
|
|
@@ -1097,25 +1165,25 @@ const T = {
|
|
|
1097
1165
|
// Seconds timestamp
|
|
1098
1166
|
t: function(t, e, n) {
|
|
1099
1167
|
const r = Math.trunc(+t / 1e3);
|
|
1100
|
-
return
|
|
1168
|
+
return u(r, e.length);
|
|
1101
1169
|
},
|
|
1102
1170
|
// Milliseconds timestamp
|
|
1103
1171
|
T: function(t, e, n) {
|
|
1104
|
-
return
|
|
1172
|
+
return u(+t, e.length);
|
|
1105
1173
|
}
|
|
1106
1174
|
};
|
|
1107
|
-
function
|
|
1175
|
+
function st(t, e = "") {
|
|
1108
1176
|
const n = t > 0 ? "-" : "+", r = Math.abs(t), a = Math.trunc(r / 60), s = r % 60;
|
|
1109
|
-
return s === 0 ? n + String(a) : n + String(a) + e +
|
|
1177
|
+
return s === 0 ? n + String(a) : n + String(a) + e + u(s, 2);
|
|
1110
1178
|
}
|
|
1111
|
-
function
|
|
1112
|
-
return t % 60 === 0 ? (t > 0 ? "-" : "+") +
|
|
1179
|
+
function it(t, e) {
|
|
1180
|
+
return t % 60 === 0 ? (t > 0 ? "-" : "+") + u(Math.abs(t) / 60, 2) : N(t, e);
|
|
1113
1181
|
}
|
|
1114
1182
|
function N(t, e = "") {
|
|
1115
|
-
const n = t > 0 ? "-" : "+", r = Math.abs(t), a =
|
|
1183
|
+
const n = t > 0 ? "-" : "+", r = Math.abs(t), a = u(Math.trunc(r / 60), 2), s = u(r % 60, 2);
|
|
1116
1184
|
return n + a + e + s;
|
|
1117
1185
|
}
|
|
1118
|
-
const
|
|
1186
|
+
const ot = (t, e) => {
|
|
1119
1187
|
switch (t) {
|
|
1120
1188
|
case "P":
|
|
1121
1189
|
return e.date({ width: "short" });
|
|
@@ -1127,7 +1195,7 @@ const at = (t, e) => {
|
|
|
1127
1195
|
default:
|
|
1128
1196
|
return e.date({ width: "full" });
|
|
1129
1197
|
}
|
|
1130
|
-
},
|
|
1198
|
+
}, gt = (t, e) => {
|
|
1131
1199
|
switch (t) {
|
|
1132
1200
|
case "p":
|
|
1133
1201
|
return e.time({ width: "short" });
|
|
@@ -1139,10 +1207,10 @@ const at = (t, e) => {
|
|
|
1139
1207
|
default:
|
|
1140
1208
|
return e.time({ width: "full" });
|
|
1141
1209
|
}
|
|
1142
|
-
},
|
|
1210
|
+
}, he = (t, e) => {
|
|
1143
1211
|
const n = t.match(/(P+)(p+)?/) || [], r = n[1], a = n[2];
|
|
1144
1212
|
if (!a)
|
|
1145
|
-
return
|
|
1213
|
+
return ot(t, e);
|
|
1146
1214
|
let s;
|
|
1147
1215
|
switch (r) {
|
|
1148
1216
|
case "P":
|
|
@@ -1159,155 +1227,167 @@ const at = (t, e) => {
|
|
|
1159
1227
|
s = e.dateTime({ width: "full" });
|
|
1160
1228
|
break;
|
|
1161
1229
|
}
|
|
1162
|
-
return s.replace("{{date}}",
|
|
1163
|
-
},
|
|
1164
|
-
p:
|
|
1165
|
-
P:
|
|
1166
|
-
},
|
|
1167
|
-
function
|
|
1168
|
-
return
|
|
1230
|
+
return s.replace("{{date}}", ot(r, e)).replace("{{time}}", gt(a, e));
|
|
1231
|
+
}, de = {
|
|
1232
|
+
p: gt,
|
|
1233
|
+
P: he
|
|
1234
|
+
}, fe = /^D+$/, me = /^Y+$/, ge = ["D", "DD", "YY", "YYYY"];
|
|
1235
|
+
function ye(t) {
|
|
1236
|
+
return fe.test(t);
|
|
1169
1237
|
}
|
|
1170
|
-
function
|
|
1171
|
-
return
|
|
1238
|
+
function pe(t) {
|
|
1239
|
+
return me.test(t);
|
|
1172
1240
|
}
|
|
1173
|
-
function
|
|
1174
|
-
const r =
|
|
1175
|
-
if (console.warn(r),
|
|
1241
|
+
function we(t, e, n) {
|
|
1242
|
+
const r = be(t, e, n);
|
|
1243
|
+
if (console.warn(r), ge.includes(t)) throw new RangeError(r);
|
|
1176
1244
|
}
|
|
1177
|
-
function
|
|
1245
|
+
function be(t, e, n) {
|
|
1178
1246
|
const r = t[0] === "Y" ? "years" : "days of the month";
|
|
1179
1247
|
return `Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
|
|
1180
1248
|
}
|
|
1181
|
-
const
|
|
1182
|
-
function
|
|
1183
|
-
var
|
|
1184
|
-
const r = L(), a = r.locale ??
|
|
1185
|
-
if (!
|
|
1249
|
+
const ke = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g, De = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g, Se = /^'([^]*?)'?$/, Me = /''/g, ve = /[a-zA-Z]/;
|
|
1250
|
+
function Te(t, e, n) {
|
|
1251
|
+
var d, m, g, S;
|
|
1252
|
+
const r = L(), a = r.locale ?? oe, s = r.firstWeekContainsDate ?? ((m = (d = r.locale) == null ? void 0 : d.options) == null ? void 0 : m.firstWeekContainsDate) ?? 1, i = r.weekStartsOn ?? ((S = (g = r.locale) == null ? void 0 : g.options) == null ? void 0 : S.weekStartsOn) ?? 0, o = k(t, n == null ? void 0 : n.in);
|
|
1253
|
+
if (!xt(o))
|
|
1186
1254
|
throw new RangeError("Invalid time value");
|
|
1187
|
-
let c = e.match(
|
|
1188
|
-
const
|
|
1189
|
-
if (
|
|
1190
|
-
const
|
|
1191
|
-
return
|
|
1255
|
+
let c = e.match(De).map((b) => {
|
|
1256
|
+
const w = b[0];
|
|
1257
|
+
if (w === "p" || w === "P") {
|
|
1258
|
+
const W = de[w];
|
|
1259
|
+
return W(b, a.formatLong);
|
|
1192
1260
|
}
|
|
1193
|
-
return
|
|
1194
|
-
}).join("").match(
|
|
1195
|
-
if (
|
|
1261
|
+
return b;
|
|
1262
|
+
}).join("").match(ke).map((b) => {
|
|
1263
|
+
if (b === "''")
|
|
1196
1264
|
return { isToken: !1, value: "'" };
|
|
1197
|
-
const
|
|
1198
|
-
if (
|
|
1199
|
-
return { isToken: !1, value:
|
|
1200
|
-
if (
|
|
1201
|
-
return { isToken: !0, value:
|
|
1202
|
-
if (
|
|
1265
|
+
const w = b[0];
|
|
1266
|
+
if (w === "'")
|
|
1267
|
+
return { isToken: !1, value: xe(b) };
|
|
1268
|
+
if (at[w])
|
|
1269
|
+
return { isToken: !0, value: b };
|
|
1270
|
+
if (w.match(ve))
|
|
1203
1271
|
throw new RangeError(
|
|
1204
|
-
"Format string contains an unescaped latin alphabet character `" +
|
|
1272
|
+
"Format string contains an unescaped latin alphabet character `" + w + "`"
|
|
1205
1273
|
);
|
|
1206
|
-
return { isToken: !1, value:
|
|
1274
|
+
return { isToken: !1, value: b };
|
|
1207
1275
|
});
|
|
1208
1276
|
a.localize.preprocessor && (c = a.localize.preprocessor(o, c));
|
|
1209
|
-
const
|
|
1277
|
+
const l = {
|
|
1210
1278
|
firstWeekContainsDate: s,
|
|
1211
1279
|
weekStartsOn: i,
|
|
1212
1280
|
locale: a
|
|
1213
1281
|
};
|
|
1214
|
-
return c.map((
|
|
1215
|
-
if (!
|
|
1216
|
-
const
|
|
1217
|
-
(
|
|
1218
|
-
const
|
|
1219
|
-
return
|
|
1282
|
+
return c.map((b) => {
|
|
1283
|
+
if (!b.isToken) return b.value;
|
|
1284
|
+
const w = b.value;
|
|
1285
|
+
(pe(w) || ye(w)) && we(w, e, String(t));
|
|
1286
|
+
const W = at[w[0]];
|
|
1287
|
+
return W(o, w, a.localize, l);
|
|
1220
1288
|
}).join("");
|
|
1221
1289
|
}
|
|
1222
|
-
function
|
|
1223
|
-
const e = t.match(
|
|
1224
|
-
return e ? e[1].replace(
|
|
1290
|
+
function xe(t) {
|
|
1291
|
+
const e = t.match(Se);
|
|
1292
|
+
return e ? e[1].replace(Me, "'") : t;
|
|
1225
1293
|
}
|
|
1226
|
-
function
|
|
1294
|
+
function Oe(t, e) {
|
|
1227
1295
|
const n = k(t, e == null ? void 0 : e.in).getDay();
|
|
1228
1296
|
return n === 0 ? 7 : n;
|
|
1229
1297
|
}
|
|
1230
|
-
|
|
1231
|
-
|
|
1298
|
+
function Pe(t, e, n = "long") {
|
|
1299
|
+
return new Intl.DateTimeFormat("en-US", {
|
|
1300
|
+
// Enforces engine to render the time. Without the option JavaScriptCore omits it.
|
|
1301
|
+
hour: "numeric",
|
|
1302
|
+
timeZone: t,
|
|
1303
|
+
timeZoneName: n
|
|
1304
|
+
}).format(e).split(/\s/g).slice(2).join(" ");
|
|
1305
|
+
}
|
|
1306
|
+
const J = {}, H = {};
|
|
1307
|
+
function $(t, e) {
|
|
1232
1308
|
try {
|
|
1233
|
-
const r = (
|
|
1309
|
+
const r = (J[t] || (J[t] = new Intl.DateTimeFormat("en-US", {
|
|
1234
1310
|
timeZone: t,
|
|
1235
|
-
hour: "numeric",
|
|
1236
1311
|
timeZoneName: "longOffset"
|
|
1237
|
-
}).format))(e).split("GMT")[1]
|
|
1238
|
-
return r in
|
|
1312
|
+
}).format))(e).split("GMT")[1];
|
|
1313
|
+
return r in H ? H[r] : ct(r, r.split(":"));
|
|
1239
1314
|
} catch {
|
|
1240
|
-
if (t in
|
|
1241
|
-
const n = t == null ? void 0 : t.match(
|
|
1242
|
-
return n ?
|
|
1315
|
+
if (t in H) return H[t];
|
|
1316
|
+
const n = t == null ? void 0 : t.match(Ne);
|
|
1317
|
+
return n ? ct(t, n.slice(1)) : NaN;
|
|
1243
1318
|
}
|
|
1244
1319
|
}
|
|
1245
|
-
const
|
|
1246
|
-
function
|
|
1247
|
-
const n = +e[0], r = +(e[1] || 0);
|
|
1248
|
-
return
|
|
1320
|
+
const Ne = /([+-]\d\d):?(\d\d)?/;
|
|
1321
|
+
function ct(t, e) {
|
|
1322
|
+
const n = +(e[0] || 0), r = +(e[1] || 0), a = +(e[2] || 0) / 60;
|
|
1323
|
+
return H[t] = n * 60 + r > 0 ? n * 60 + r + a : n * 60 - r - a;
|
|
1249
1324
|
}
|
|
1250
|
-
class
|
|
1325
|
+
class M extends Date {
|
|
1251
1326
|
//#region static
|
|
1252
1327
|
constructor(...e) {
|
|
1253
|
-
super(), e.length > 1 && typeof e[e.length - 1] == "string" && (this.timeZone = e.pop()), this.internal = /* @__PURE__ */ new Date(), isNaN(
|
|
1328
|
+
super(), e.length > 1 && typeof e[e.length - 1] == "string" && (this.timeZone = e.pop()), this.internal = /* @__PURE__ */ new Date(), isNaN($(this.timeZone, this)) ? this.setTime(NaN) : e.length ? typeof e[0] == "number" && (e.length === 1 || e.length === 2 && typeof e[1] != "number") ? this.setTime(e[0]) : typeof e[0] == "string" ? this.setTime(+new Date(e[0])) : e[0] instanceof Date ? this.setTime(+e[0]) : (this.setTime(+new Date(...e)), yt(this), K(this)) : this.setTime(Date.now());
|
|
1254
1329
|
}
|
|
1255
1330
|
static tz(e, ...n) {
|
|
1256
|
-
return n.length ? new
|
|
1331
|
+
return n.length ? new M(...n, e) : new M(Date.now(), e);
|
|
1257
1332
|
}
|
|
1258
1333
|
//#endregion
|
|
1259
1334
|
//#region time zone
|
|
1260
1335
|
withTimeZone(e) {
|
|
1261
|
-
return new
|
|
1336
|
+
return new M(+this, e);
|
|
1262
1337
|
}
|
|
1263
1338
|
getTimezoneOffset() {
|
|
1264
|
-
|
|
1339
|
+
const e = -$(this.timeZone, this);
|
|
1340
|
+
return e > 0 ? Math.floor(e) : Math.ceil(e);
|
|
1265
1341
|
}
|
|
1266
1342
|
//#endregion
|
|
1267
1343
|
//#region time
|
|
1268
1344
|
setTime(e) {
|
|
1269
|
-
return Date.prototype.setTime.apply(this, arguments),
|
|
1345
|
+
return Date.prototype.setTime.apply(this, arguments), K(this), +this;
|
|
1270
1346
|
}
|
|
1271
1347
|
//#endregion
|
|
1272
1348
|
//#region date-fns integration
|
|
1273
1349
|
[Symbol.for("constructDateFrom")](e) {
|
|
1274
|
-
return new
|
|
1350
|
+
return new M(+new Date(e), this.timeZone);
|
|
1275
1351
|
}
|
|
1276
1352
|
//#endregion
|
|
1277
1353
|
}
|
|
1278
|
-
const
|
|
1354
|
+
const lt = /^(get|set)(?!UTC)/;
|
|
1279
1355
|
Object.getOwnPropertyNames(Date.prototype).forEach((t) => {
|
|
1280
|
-
if (!
|
|
1281
|
-
const e = t.replace(
|
|
1282
|
-
|
|
1356
|
+
if (!lt.test(t)) return;
|
|
1357
|
+
const e = t.replace(lt, "$1UTC");
|
|
1358
|
+
M.prototype[e] && (t.startsWith("get") ? M.prototype[t] = function() {
|
|
1283
1359
|
return this.internal[e]();
|
|
1284
|
-
} : (
|
|
1285
|
-
return Date.prototype[e].apply(this.internal, arguments),
|
|
1286
|
-
},
|
|
1287
|
-
return Date.prototype[e].apply(this, arguments),
|
|
1360
|
+
} : (M.prototype[t] = function() {
|
|
1361
|
+
return Date.prototype[e].apply(this.internal, arguments), $e(this), +this;
|
|
1362
|
+
}, M.prototype[e] = function() {
|
|
1363
|
+
return Date.prototype[e].apply(this, arguments), K(this), +this;
|
|
1288
1364
|
}));
|
|
1289
1365
|
});
|
|
1290
|
-
function
|
|
1291
|
-
t.internal.setTime(+t), t.internal.
|
|
1366
|
+
function K(t) {
|
|
1367
|
+
t.internal.setTime(+t), t.internal.setUTCSeconds(t.internal.getUTCSeconds() - Math.round(-$(t.timeZone, t) * 60));
|
|
1292
1368
|
}
|
|
1293
|
-
function
|
|
1294
|
-
Date.prototype.setFullYear.call(t, t.internal.getUTCFullYear(), t.internal.getUTCMonth(), t.internal.getUTCDate()), Date.prototype.setHours.call(t, t.internal.getUTCHours(), t.internal.getUTCMinutes(), t.internal.getUTCSeconds(), t.internal.getUTCMilliseconds()),
|
|
1369
|
+
function $e(t) {
|
|
1370
|
+
Date.prototype.setFullYear.call(t, t.internal.getUTCFullYear(), t.internal.getUTCMonth(), t.internal.getUTCDate()), Date.prototype.setHours.call(t, t.internal.getUTCHours(), t.internal.getUTCMinutes(), t.internal.getUTCSeconds(), t.internal.getUTCMilliseconds()), yt(t);
|
|
1295
1371
|
}
|
|
1296
|
-
function
|
|
1297
|
-
const e =
|
|
1298
|
-
|
|
1299
|
-
const
|
|
1300
|
-
|
|
1301
|
-
const
|
|
1302
|
-
|
|
1303
|
-
const
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1372
|
+
function yt(t) {
|
|
1373
|
+
const e = $(t.timeZone, t), n = e > 0 ? Math.floor(e) : Math.ceil(e), r = /* @__PURE__ */ new Date(+t);
|
|
1374
|
+
r.setUTCHours(r.getUTCHours() - 1);
|
|
1375
|
+
const a = -(/* @__PURE__ */ new Date(+t)).getTimezoneOffset(), s = -(/* @__PURE__ */ new Date(+r)).getTimezoneOffset(), i = a - s, o = Date.prototype.getHours.apply(t) !== t.internal.getUTCHours();
|
|
1376
|
+
i && o && t.internal.setUTCMinutes(t.internal.getUTCMinutes() + i);
|
|
1377
|
+
const c = a - n;
|
|
1378
|
+
c && Date.prototype.setUTCMinutes.call(t, Date.prototype.getUTCMinutes.call(t) + c);
|
|
1379
|
+
const l = /* @__PURE__ */ new Date(+t);
|
|
1380
|
+
l.setUTCSeconds(0);
|
|
1381
|
+
const d = a > 0 ? l.getSeconds() : (l.getSeconds() - 60) % 60, m = Math.round(-($(t.timeZone, t) * 60)) % 60;
|
|
1382
|
+
(m || d) && (t.internal.setUTCSeconds(t.internal.getUTCSeconds() + m), Date.prototype.setUTCSeconds.call(t, Date.prototype.getUTCSeconds.call(t) + m + d));
|
|
1383
|
+
const g = $(t.timeZone, t), S = g > 0 ? Math.floor(g) : Math.ceil(g), w = -(/* @__PURE__ */ new Date(+t)).getTimezoneOffset() - S, W = S !== n, Z = w - c;
|
|
1384
|
+
if (W && Z) {
|
|
1385
|
+
Date.prototype.setUTCMinutes.call(t, Date.prototype.getUTCMinutes.call(t) + Z);
|
|
1386
|
+
const j = $(t.timeZone, t), wt = j > 0 ? Math.floor(j) : Math.ceil(j), z = S - wt;
|
|
1387
|
+
z && (t.internal.setUTCMinutes(t.internal.getUTCMinutes() + z), Date.prototype.setUTCMinutes.call(t, Date.prototype.getUTCMinutes.call(t) + z));
|
|
1308
1388
|
}
|
|
1309
1389
|
}
|
|
1310
|
-
class O extends
|
|
1390
|
+
class O extends M {
|
|
1311
1391
|
//#region static
|
|
1312
1392
|
static tz(e, ...n) {
|
|
1313
1393
|
return n.length ? new O(...n, e) : new O(Date.now(), e);
|
|
@@ -1327,7 +1407,7 @@ class O extends S {
|
|
|
1327
1407
|
}
|
|
1328
1408
|
toTimeString() {
|
|
1329
1409
|
const e = this.internal.toUTCString().split(" ")[4], [n, r, a] = this.tzComponents();
|
|
1330
|
-
return `${e} GMT${n}${r}${a} (${
|
|
1410
|
+
return `${e} GMT${n}${r}${a} (${Pe(this.timeZone, this)})`;
|
|
1331
1411
|
}
|
|
1332
1412
|
toLocaleString(e, n) {
|
|
1333
1413
|
return Date.prototype.toLocaleString.call(this, e, {
|
|
@@ -1363,18 +1443,12 @@ class O extends S {
|
|
|
1363
1443
|
}
|
|
1364
1444
|
//#endregion
|
|
1365
1445
|
}
|
|
1366
|
-
function xe(t, e) {
|
|
1367
|
-
return new Intl.DateTimeFormat("en-GB", {
|
|
1368
|
-
timeZone: t,
|
|
1369
|
-
timeZoneName: "long"
|
|
1370
|
-
}).format(e).slice(12);
|
|
1371
|
-
}
|
|
1372
1446
|
window.pktTz = window.pktTz === void 0 ? "Europe/Oslo" : window.pktTz;
|
|
1373
|
-
const
|
|
1447
|
+
const Ce = (t = window.pktTz) => {
|
|
1374
1448
|
const e = new O((/* @__PURE__ */ new Date()).toISOString(), t);
|
|
1375
1449
|
return e.setHours(0, 0, 0, 0), isNaN(e.getTime()) ? /* @__PURE__ */ new Date() : new Date(e.getFullYear(), e.getMonth(), e.getDate());
|
|
1376
1450
|
};
|
|
1377
|
-
function
|
|
1451
|
+
function C(t) {
|
|
1378
1452
|
if (!t || t === "") return /* @__PURE__ */ new Date();
|
|
1379
1453
|
if (/^\d{4}-\d{2}-\d{2}$/.test(t)) {
|
|
1380
1454
|
const [e, n, r] = t.split("-").map(Number);
|
|
@@ -1390,89 +1464,67 @@ const p = (t) => {
|
|
|
1390
1464
|
if (!t || isNaN(t.getTime())) return "";
|
|
1391
1465
|
const e = t.getFullYear(), n = String(t.getMonth() + 1).padStart(2, "0"), r = String(t.getDate()).padStart(2, "0");
|
|
1392
1466
|
return `${e}-${n}-${r}`;
|
|
1393
|
-
},
|
|
1467
|
+
}, R = (t) => {
|
|
1394
1468
|
if (!t)
|
|
1395
1469
|
return null;
|
|
1396
|
-
const e =
|
|
1470
|
+
const e = C(t);
|
|
1397
1471
|
return isNaN(e.getTime()) ? null : e;
|
|
1398
|
-
},
|
|
1399
|
-
const n =
|
|
1400
|
-
return isNaN(n.getTime()) ? "" :
|
|
1401
|
-
},
|
|
1402
|
-
const n = typeof t == "string" ?
|
|
1472
|
+
}, ze = (t, e) => {
|
|
1473
|
+
const n = E(t);
|
|
1474
|
+
return isNaN(n.getTime()) ? "" : Te(n, e);
|
|
1475
|
+
}, E = (t = "", e) => {
|
|
1476
|
+
const n = typeof t == "string" ? C(t) : t;
|
|
1403
1477
|
return !n || isNaN(n.getTime()) ? /* @__PURE__ */ new Date() : n;
|
|
1404
1478
|
}, x = (t, e, n = 1) => {
|
|
1405
1479
|
if (typeof t != "number" || typeof e != "number" || typeof n != "number" || isNaN(t) || isNaN(e) || isNaN(n))
|
|
1406
1480
|
return /* @__PURE__ */ new Date();
|
|
1407
1481
|
const r = new Date(t, e, n);
|
|
1408
1482
|
return isNaN(r.getTime()) ? /* @__PURE__ */ new Date() : r;
|
|
1409
|
-
},
|
|
1483
|
+
}, F = (t) => {
|
|
1410
1484
|
let e;
|
|
1411
1485
|
return typeof t == "number" ? e = new O(t, window.pktTz) : e = new O(t, window.pktTz), e.setHours(12, 0, 0, 0), e;
|
|
1412
|
-
},
|
|
1486
|
+
}, _e = (t) => !t || isNaN(t.getTime()) ? "" : new Intl.DateTimeFormat("no", { dateStyle: "full", timeZone: window.pktTz }).format(t), Ee = (t, e, n) => {
|
|
1413
1487
|
if (!t || isNaN(t.getTime())) return !1;
|
|
1414
|
-
const r = e ?
|
|
1488
|
+
const r = e ? E(e) : null, a = n ? E(n) : null;
|
|
1415
1489
|
return !(r && t < r || a && t > a);
|
|
1416
|
-
},
|
|
1490
|
+
}, We = (t, e) => {
|
|
1417
1491
|
if (!t || isNaN(t.getTime()) || !Array.isArray(e)) return !1;
|
|
1418
1492
|
const n = p(t);
|
|
1419
1493
|
return e.includes(n);
|
|
1420
|
-
},
|
|
1494
|
+
}, Ye = (t, e) => {
|
|
1421
1495
|
if (!t || isNaN(t.getTime()) || !Array.isArray(e)) return !1;
|
|
1422
1496
|
const n = t.getDay().toString();
|
|
1423
1497
|
return e.includes(n);
|
|
1424
|
-
},
|
|
1425
|
-
const i =
|
|
1426
|
-
return i &&
|
|
1427
|
-
}),
|
|
1428
|
-
const r =
|
|
1498
|
+
}, pt = (t, e, n, r, a) => !(!t || isNaN(t.getTime()) || !Ee(t, e, n) || r && We(t, r) || a && Ye(t, a)), Qe = (t, e, n, r, a) => t.filter((s) => {
|
|
1499
|
+
const i = R(s);
|
|
1500
|
+
return i && pt(i, e, n, r, a);
|
|
1501
|
+
}), Xe = (t) => t.slice().sort((e, n) => {
|
|
1502
|
+
const r = R(e), a = R(n);
|
|
1429
1503
|
return !r || !a ? 0 : r.getTime() - a.getTime();
|
|
1430
|
-
}),
|
|
1431
|
-
const n =
|
|
1504
|
+
}), Ge = (t, e) => {
|
|
1505
|
+
const n = R(t), r = R(e);
|
|
1432
1506
|
return !n || !r ? !1 : n <= r;
|
|
1433
|
-
},
|
|
1507
|
+
}, Ae = (t) => {
|
|
1434
1508
|
if (Array.isArray(t)) return t;
|
|
1435
1509
|
if (typeof t == "string") return t.split(",");
|
|
1436
|
-
},
|
|
1510
|
+
}, Fe = (t) => t ? C(t) : null, He = (t) => {
|
|
1437
1511
|
if (typeof t == "string")
|
|
1438
|
-
return t.split(",").map((e) =>
|
|
1512
|
+
return t.split(",").map((e) => C(e));
|
|
1439
1513
|
if (Array.isArray(t))
|
|
1440
|
-
return t.map((e) =>
|
|
1441
|
-
},
|
|
1442
|
-
csvToArray:
|
|
1443
|
-
stringToDate:
|
|
1444
|
-
stringsToDate:
|
|
1445
|
-
},
|
|
1446
|
-
|
|
1447
|
-
default: null
|
|
1448
|
-
},
|
|
1449
|
-
latest: {
|
|
1450
|
-
default: null
|
|
1451
|
-
},
|
|
1452
|
-
weeknumbers: {
|
|
1453
|
-
default: !1
|
|
1454
|
-
},
|
|
1455
|
-
withcontrols: {
|
|
1456
|
-
default: !1
|
|
1457
|
-
},
|
|
1458
|
-
multiple: {
|
|
1459
|
-
default: !1
|
|
1460
|
-
},
|
|
1461
|
-
maxMultiple: {
|
|
1462
|
-
default: 4
|
|
1463
|
-
},
|
|
1464
|
-
range: {
|
|
1465
|
-
default: !1
|
|
1466
|
-
}
|
|
1467
|
-
}, P = {
|
|
1468
|
-
props: Ye
|
|
1514
|
+
return t.map((e) => C(e));
|
|
1515
|
+
}, B = {
|
|
1516
|
+
csvToArray: Ae,
|
|
1517
|
+
stringToDate: Fe,
|
|
1518
|
+
stringsToDate: He
|
|
1519
|
+
}, Ie = { earliest: { default: null }, latest: { default: null }, weeknumbers: { default: !1 }, withcontrols: { default: !1 }, multiple: { default: !1 }, maxMultiple: { default: 4 }, range: { default: !1 } }, P = {
|
|
1520
|
+
props: Ie
|
|
1469
1521
|
};
|
|
1470
|
-
var
|
|
1471
|
-
for (var a = r > 1 ? void 0 : r ?
|
|
1522
|
+
var Re = Object.defineProperty, Ue = Object.getOwnPropertyDescriptor, f = (t, e, n, r) => {
|
|
1523
|
+
for (var a = r > 1 ? void 0 : r ? Ue(e, n) : e, s = t.length - 1, i; s >= 0; s--)
|
|
1472
1524
|
(i = t[s]) && (a = (r ? i(e, n, a) : i(a)) || a);
|
|
1473
|
-
return r && a &&
|
|
1525
|
+
return r && a && Re(e, n, a), a;
|
|
1474
1526
|
};
|
|
1475
|
-
let
|
|
1527
|
+
let h = class extends bt {
|
|
1476
1528
|
constructor() {
|
|
1477
1529
|
super(...arguments), this.multiple = P.props.multiple.default, this.maxMultiple = P.props.maxMultiple.default, this.range = P.props.range.default, this.weeknumbers = P.props.weeknumbers.default, this.withcontrols = P.props.withcontrols.default, this.selected = [], this.earliest = P.props.earliest.default, this.latest = P.props.latest.default, this.excludedates = [], this.excludeweekdays = [], this.currentmonth = null, this.dayStrings = this.strings.dates.daysShort, this.dayStringsLong = this.strings.dates.days, this.monthStrings = this.strings.dates.months, this.weekString = this.strings.dates.week, this.prevMonthString = this.strings.dates.prevMonth, this.nextMonthString = this.strings.dates.nextMonth, this._selected = [], this.year = 0, this.month = 0, this.week = 0, this.rangeHovered = null, this.inRange = {}, this.focusedDate = null, this.selectableDates = [], this.currentmonthtouched = !1, this.tabIndexSet = 0;
|
|
1478
1530
|
}
|
|
@@ -1495,8 +1547,8 @@ let u = class extends gt {
|
|
|
1495
1547
|
this.addEventListener("keydown", this.handleKeydown);
|
|
1496
1548
|
}
|
|
1497
1549
|
convertSelected() {
|
|
1498
|
-
if (typeof this.selected == "string" && (this.selected = this.selected.split(",")), this.selected.length === 1 && this.selected[0] === "" && (this.selected = []), this._selected = this.selected.map((t) =>
|
|
1499
|
-
const t =
|
|
1550
|
+
if (typeof this.selected == "string" && (this.selected = this.selected.split(",")), this.selected.length === 1 && this.selected[0] === "" && (this.selected = []), this._selected = this.selected.map((t) => C(t)), this.range && this.selected.length === 2) {
|
|
1551
|
+
const t = G({
|
|
1500
1552
|
start: this._selected[0],
|
|
1501
1553
|
end: this._selected[1]
|
|
1502
1554
|
});
|
|
@@ -1513,10 +1565,10 @@ let u = class extends gt {
|
|
|
1513
1565
|
}
|
|
1514
1566
|
setCurrentMonth() {
|
|
1515
1567
|
if (this.currentmonth === null && !this.currentmonthtouched && (this.currentmonthtouched = !0), this.selected.length && this.selected[0] !== "") {
|
|
1516
|
-
const t =
|
|
1517
|
-
this.currentmonth = isNaN(t.getTime()) ?
|
|
1518
|
-
} else this.currentmonth === null && (this.currentmonth =
|
|
1519
|
-
(!this.currentmonth || isNaN(this.currentmonth.getTime())) && (this.currentmonth =
|
|
1568
|
+
const t = C(this.selected[this.selected.length - 1]);
|
|
1569
|
+
this.currentmonth = isNaN(t.getTime()) ? F(/* @__PURE__ */ new Date()) : t;
|
|
1570
|
+
} else this.currentmonth === null && (this.currentmonth = F(/* @__PURE__ */ new Date()));
|
|
1571
|
+
(!this.currentmonth || isNaN(this.currentmonth.getTime())) && (this.currentmonth = F(/* @__PURE__ */ new Date())), this.year = this.currentmonth.getFullYear(), this.month = this.currentmonth.getMonth();
|
|
1520
1572
|
}
|
|
1521
1573
|
handleKeydown(t) {
|
|
1522
1574
|
switch (t.key) {
|
|
@@ -1539,19 +1591,19 @@ let u = class extends gt {
|
|
|
1539
1591
|
if (((a = t.target) == null ? void 0 : a.nodeName) === "INPUT" || ((s = t.target) == null ? void 0 : s.nodeName) === "SELECT" || ((i = t.target) == null ? void 0 : i.nodeName) === "BUTTON" && !((c = (o = t.target) == null ? void 0 : o.dataset) != null && c.date))
|
|
1540
1592
|
return;
|
|
1541
1593
|
t.preventDefault(), this.focusedDate || this.focusOnCurrentDate();
|
|
1542
|
-
const n = this.focusedDate ?
|
|
1543
|
-
let r =
|
|
1594
|
+
const n = this.focusedDate ? E(this.focusedDate) : x(this.year, this.month, 1);
|
|
1595
|
+
let r = X(n, e);
|
|
1544
1596
|
if (r) {
|
|
1545
|
-
let
|
|
1546
|
-
if (
|
|
1547
|
-
if (
|
|
1548
|
-
r =
|
|
1549
|
-
let
|
|
1550
|
-
for (;
|
|
1551
|
-
r =
|
|
1552
|
-
|
|
1597
|
+
let l = this.querySelector(`button[data-date="${p(r)}"]`);
|
|
1598
|
+
if (l instanceof HTMLButtonElement) {
|
|
1599
|
+
if (l.dataset.disabled) {
|
|
1600
|
+
r = X(r, e);
|
|
1601
|
+
let d = this.querySelector(`button[data-date="${p(r)}"]`);
|
|
1602
|
+
for (; d && d instanceof HTMLButtonElement && d.dataset.disabled; )
|
|
1603
|
+
r = X(r, e), d = this.querySelector(`button[data-date="${p(r)}"]`);
|
|
1604
|
+
l = d;
|
|
1553
1605
|
}
|
|
1554
|
-
|
|
1606
|
+
l instanceof HTMLButtonElement && !l.dataset.disabled && (this.focusedDate = p(r), l.focus());
|
|
1555
1607
|
}
|
|
1556
1608
|
}
|
|
1557
1609
|
}
|
|
@@ -1577,7 +1629,7 @@ let u = class extends gt {
|
|
|
1577
1629
|
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), this.isPrevMonthAllowed() && this.prevMonth());
|
|
1578
1630
|
}}
|
|
1579
1631
|
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only pkt-calendar__prev-month ${this.isPrevMonthAllowed() ? "" : "pkt-hide"}"
|
|
1580
|
-
.data-disabled=${this.isPrevMonthAllowed() ?
|
|
1632
|
+
.data-disabled=${this.isPrevMonthAllowed() ? Q : "disabled"}
|
|
1581
1633
|
?aria-disabled=${!this.isPrevMonthAllowed()}
|
|
1582
1634
|
tabindex=${this.isPrevMonthAllowed() ? "0" : "-1"}
|
|
1583
1635
|
>
|
|
@@ -1595,7 +1647,7 @@ let u = class extends gt {
|
|
|
1595
1647
|
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), this.isNextMonthAllowed() && this.nextMonth());
|
|
1596
1648
|
}}
|
|
1597
1649
|
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only pkt-calendar__next-month ${this.isNextMonthAllowed() ? "" : "pkt-hide"}"
|
|
1598
|
-
.data-disabled=${this.isNextMonthAllowed() ?
|
|
1650
|
+
.data-disabled=${this.isNextMonthAllowed() ? Q : "disabled"}
|
|
1599
1651
|
?aria-disabled=${!this.isNextMonthAllowed()}
|
|
1600
1652
|
tabindex=${this.isNextMonthAllowed() ? "0" : "-1"}
|
|
1601
1653
|
>
|
|
@@ -1672,10 +1724,10 @@ let u = class extends gt {
|
|
|
1672
1724
|
), t;
|
|
1673
1725
|
}
|
|
1674
1726
|
renderDayView(t, e) {
|
|
1675
|
-
var
|
|
1676
|
-
const n = x(this.year, this.month, t), r = p(n), a = r === p(e), s = this.selected.includes(r), i =
|
|
1727
|
+
var m;
|
|
1728
|
+
const n = x(this.year, this.month, t), r = p(n), a = r === p(e), s = this.selected.includes(r), i = _e(n), o = this.isExcluded(n) || !s && this.multiple && this.maxMultiple > 0 && this.selected.length >= this.maxMultiple, c = this.focusedDate ? this.focusedDate === r && !o ? "0" : "-1" : !o && this.tabIndexSet === 0 || this.tabIndexSet === t ? "0" : "-1";
|
|
1677
1729
|
c === "0" && (this.tabIndexSet = t), this.selectableDates.push({ currentDateISO: r, isDisabled: o, tabindex: c });
|
|
1678
|
-
const
|
|
1730
|
+
const l = {
|
|
1679
1731
|
"pkt-cal-today": a,
|
|
1680
1732
|
"pkt-cal-selected": s,
|
|
1681
1733
|
"pkt-cal-in-range": this.inRange[r],
|
|
@@ -1683,7 +1735,7 @@ let u = class extends gt {
|
|
|
1683
1735
|
"pkt-cal-in-range-first": this.range && (this.selected.length === 2 || this.rangeHovered !== null) && r === this.selected[0],
|
|
1684
1736
|
"pkt-cal-in-range-last": this.range && this.selected.length === 2 && r === this.selected[1],
|
|
1685
1737
|
"pkt-cal-range-hover": this.rangeHovered !== null && r === p(this.rangeHovered)
|
|
1686
|
-
},
|
|
1738
|
+
}, d = {
|
|
1687
1739
|
"pkt-calendar__date": !0,
|
|
1688
1740
|
"pkt-calendar__date--today": a,
|
|
1689
1741
|
"pkt-calendar__date--selected": s,
|
|
@@ -1693,21 +1745,21 @@ let u = class extends gt {
|
|
|
1693
1745
|
"pkt-calendar__date--range-start": this.range && (this.selected.length === 2 || this.rangeHovered !== null) && r === this.selected[0],
|
|
1694
1746
|
"pkt-calendar__date--range-end": this.range && this.selected.length === 2 && r === this.selected[1]
|
|
1695
1747
|
};
|
|
1696
|
-
return D`<td class=${
|
|
1748
|
+
return D`<td class=${tt(l)}>
|
|
1697
1749
|
<button
|
|
1698
1750
|
type="button"
|
|
1699
1751
|
aria-pressed=${s ? "true" : "false"}
|
|
1700
1752
|
?disabled=${o}
|
|
1701
|
-
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only ${
|
|
1702
|
-
|
|
1753
|
+
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only ${tt(
|
|
1754
|
+
d
|
|
1703
1755
|
)}"
|
|
1704
1756
|
@mouseover=${() => this.range && !this.isExcluded(n) && this.handleRangeHover(n)}
|
|
1705
1757
|
@focus=${() => {
|
|
1706
1758
|
this.range && !this.isExcluded(n) && this.handleRangeHover(n), this.focusedDate = r;
|
|
1707
1759
|
}}
|
|
1708
1760
|
aria-label="${i}"
|
|
1709
|
-
tabindex=${(
|
|
1710
|
-
data-disabled=${o ? "disabled" :
|
|
1761
|
+
tabindex=${(m = this.selectableDates.find((g) => g.currentDateISO === r)) == null ? void 0 : m.tabindex}
|
|
1762
|
+
data-disabled=${o ? "disabled" : Q}
|
|
1711
1763
|
data-date=${r}
|
|
1712
1764
|
@keydown=${(g) => {
|
|
1713
1765
|
(g.key === "Enter" || g.key === " ") && (g.preventDefault(), this.handleDateSelect(n));
|
|
@@ -1721,27 +1773,27 @@ let u = class extends gt {
|
|
|
1721
1773
|
</td>`;
|
|
1722
1774
|
}
|
|
1723
1775
|
renderCalendarBody() {
|
|
1724
|
-
const t =
|
|
1776
|
+
const t = Ce(), e = x(this.year, this.month, 1), n = x(this.year, this.month + 1, 0), r = (e.getDay() + 6) % 7, a = n.getDate(), s = Math.ceil((a + r) / 7), o = x(this.year, this.month, 0).getDate();
|
|
1725
1777
|
let c = 1;
|
|
1726
|
-
this.week =
|
|
1727
|
-
const
|
|
1728
|
-
for (let
|
|
1729
|
-
const
|
|
1730
|
-
this.weeknumbers &&
|
|
1778
|
+
this.week = mt(x(this.year, this.month, 1));
|
|
1779
|
+
const l = [];
|
|
1780
|
+
for (let d = 0; d < s; d++) {
|
|
1781
|
+
const m = [];
|
|
1782
|
+
this.weeknumbers && m.push(D`<td class="pkt-cal-week">${this.week}</td>`), this.week++;
|
|
1731
1783
|
for (let g = 1; g < 8; g++)
|
|
1732
|
-
if (
|
|
1733
|
-
const
|
|
1734
|
-
|
|
1784
|
+
if (d === 0 && g < r + 1) {
|
|
1785
|
+
const S = o - (r - g);
|
|
1786
|
+
m.push(
|
|
1735
1787
|
D`<td class="pkt-cal-other">
|
|
1736
1788
|
<div
|
|
1737
1789
|
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only"
|
|
1738
1790
|
data-disabled="disabled"
|
|
1739
1791
|
>
|
|
1740
|
-
<span class="pkt-btn__text pkt-txt-14-light">${
|
|
1792
|
+
<span class="pkt-btn__text pkt-txt-14-light">${S}</span>
|
|
1741
1793
|
</div>
|
|
1742
1794
|
</td>`
|
|
1743
1795
|
);
|
|
1744
|
-
} else c > a ? (
|
|
1796
|
+
} else c > a ? (m.push(
|
|
1745
1797
|
D`<td class="pkt-cal-other">
|
|
1746
1798
|
<div
|
|
1747
1799
|
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only"
|
|
@@ -1750,20 +1802,20 @@ let u = class extends gt {
|
|
|
1750
1802
|
<span class="pkt-btn__text pkt-txt-14-light">${c - a}</span>
|
|
1751
1803
|
</div>
|
|
1752
1804
|
</td>`
|
|
1753
|
-
), c++) : (
|
|
1754
|
-
|
|
1805
|
+
), c++) : (m.push(this.renderDayView(c, t)), c++);
|
|
1806
|
+
l.push(
|
|
1755
1807
|
D`<tr class="pkt-cal-week-row" role="row">
|
|
1756
|
-
${
|
|
1808
|
+
${m}
|
|
1757
1809
|
</tr>`
|
|
1758
1810
|
);
|
|
1759
1811
|
}
|
|
1760
|
-
return
|
|
1812
|
+
return l;
|
|
1761
1813
|
}
|
|
1762
1814
|
isExcluded(t) {
|
|
1763
1815
|
const e = this.excludedates.map(
|
|
1764
1816
|
(n) => typeof n == "string" ? n : p(n)
|
|
1765
1817
|
);
|
|
1766
|
-
return !
|
|
1818
|
+
return !pt(
|
|
1767
1819
|
t,
|
|
1768
1820
|
this.earliest,
|
|
1769
1821
|
this.latest,
|
|
@@ -1773,7 +1825,7 @@ let u = class extends gt {
|
|
|
1773
1825
|
}
|
|
1774
1826
|
isPrevMonthAllowed() {
|
|
1775
1827
|
const t = x(this.year, this.month, 0);
|
|
1776
|
-
return !(this.earliest &&
|
|
1828
|
+
return !(this.earliest && E(this.earliest) > t);
|
|
1777
1829
|
}
|
|
1778
1830
|
prevMonth() {
|
|
1779
1831
|
const t = this.month === 0 ? 11 : this.month - 1, e = this.month === 0 ? this.year - 1 : this.year;
|
|
@@ -1785,19 +1837,19 @@ let u = class extends gt {
|
|
|
1785
1837
|
this.month === 11 ? 0 : this.month + 1,
|
|
1786
1838
|
1
|
|
1787
1839
|
);
|
|
1788
|
-
return !(this.latest &&
|
|
1840
|
+
return !(this.latest && E(this.latest) < t);
|
|
1789
1841
|
}
|
|
1790
1842
|
nextMonth() {
|
|
1791
1843
|
const t = this.month === 11 ? 0 : this.month + 1, e = this.month === 11 ? this.year + 1 : this.year;
|
|
1792
1844
|
this.changeMonth(e, t);
|
|
1793
1845
|
}
|
|
1794
1846
|
changeMonth(t, e) {
|
|
1795
|
-
this.year = typeof t == "string" ? parseInt(t) : t, this.month = typeof e == "string" ? parseInt(e) : e, this.currentmonth =
|
|
1847
|
+
this.year = typeof t == "string" ? parseInt(t) : t, this.month = typeof e == "string" ? parseInt(e) : e, this.currentmonth = F(new Date(this.year, this.month, 1)), this.tabIndexSet = 0, this.focusedDate = null, this.selectableDates = [];
|
|
1796
1848
|
}
|
|
1797
1849
|
isRangeAllowed(t) {
|
|
1798
1850
|
let e = !0;
|
|
1799
1851
|
if (this._selected.length === 1) {
|
|
1800
|
-
const n =
|
|
1852
|
+
const n = G({
|
|
1801
1853
|
start: this._selected[0],
|
|
1802
1854
|
end: t
|
|
1803
1855
|
});
|
|
@@ -1805,7 +1857,7 @@ let u = class extends gt {
|
|
|
1805
1857
|
for (let r = 0; r < n.length; r++)
|
|
1806
1858
|
this.excludedates.forEach((a) => {
|
|
1807
1859
|
a > this._selected[0] && a < t && (e = !1);
|
|
1808
|
-
}), this.excludeweekdays.includes(
|
|
1860
|
+
}), this.excludeweekdays.includes(Oe(n[r]).toString()) && (e = !1);
|
|
1809
1861
|
}
|
|
1810
1862
|
return e;
|
|
1811
1863
|
}
|
|
@@ -1834,7 +1886,7 @@ let u = class extends gt {
|
|
|
1834
1886
|
handleRangeHover(t) {
|
|
1835
1887
|
if (this.range && this._selected.length === 1 && this.isRangeAllowed(t) && this._selected[0] < t) {
|
|
1836
1888
|
this.rangeHovered = t, this.inRange = {};
|
|
1837
|
-
const e =
|
|
1889
|
+
const e = G({
|
|
1838
1890
|
start: this._selected[0],
|
|
1839
1891
|
end: t
|
|
1840
1892
|
});
|
|
@@ -1857,7 +1909,7 @@ let u = class extends gt {
|
|
|
1857
1909
|
), Promise.resolve();
|
|
1858
1910
|
}
|
|
1859
1911
|
focusOnCurrentDate() {
|
|
1860
|
-
const t = p(
|
|
1912
|
+
const t = p(F(/* @__PURE__ */ new Date())), e = this.querySelector(`button[data-date="${t}"]`);
|
|
1861
1913
|
if (e instanceof HTMLButtonElement)
|
|
1862
1914
|
this.focusedDate = t, e.focus();
|
|
1863
1915
|
else {
|
|
@@ -1883,100 +1935,100 @@ let u = class extends gt {
|
|
|
1883
1935
|
);
|
|
1884
1936
|
}
|
|
1885
1937
|
};
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
],
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
],
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
],
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
],
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
],
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
],
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
],
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
],
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
],
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
],
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
],
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
],
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
],
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
],
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
],
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
],
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
],
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
],
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
],
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
],
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
],
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
],
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
],
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
],
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
],
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
],
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
],
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
],
|
|
1938
|
+
f([
|
|
1939
|
+
y({ type: Boolean })
|
|
1940
|
+
], h.prototype, "multiple", 2);
|
|
1941
|
+
f([
|
|
1942
|
+
y({ type: Number })
|
|
1943
|
+
], h.prototype, "maxMultiple", 2);
|
|
1944
|
+
f([
|
|
1945
|
+
y({ type: Boolean })
|
|
1946
|
+
], h.prototype, "range", 2);
|
|
1947
|
+
f([
|
|
1948
|
+
y({ type: Boolean })
|
|
1949
|
+
], h.prototype, "weeknumbers", 2);
|
|
1950
|
+
f([
|
|
1951
|
+
y({ type: Boolean })
|
|
1952
|
+
], h.prototype, "withcontrols", 2);
|
|
1953
|
+
f([
|
|
1954
|
+
y({ converter: B.csvToArray })
|
|
1955
|
+
], h.prototype, "selected", 2);
|
|
1956
|
+
f([
|
|
1957
|
+
y({ type: String })
|
|
1958
|
+
], h.prototype, "earliest", 2);
|
|
1959
|
+
f([
|
|
1960
|
+
y({ type: String })
|
|
1961
|
+
], h.prototype, "latest", 2);
|
|
1962
|
+
f([
|
|
1963
|
+
y({ converter: B.stringsToDate })
|
|
1964
|
+
], h.prototype, "excludedates", 2);
|
|
1965
|
+
f([
|
|
1966
|
+
y({ converter: B.csvToArray })
|
|
1967
|
+
], h.prototype, "excludeweekdays", 2);
|
|
1968
|
+
f([
|
|
1969
|
+
y({ converter: B.stringToDate })
|
|
1970
|
+
], h.prototype, "currentmonth", 2);
|
|
1971
|
+
f([
|
|
1972
|
+
y({ type: Array })
|
|
1973
|
+
], h.prototype, "dayStrings", 2);
|
|
1974
|
+
f([
|
|
1975
|
+
y({ type: Array })
|
|
1976
|
+
], h.prototype, "dayStringsLong", 2);
|
|
1977
|
+
f([
|
|
1978
|
+
y({ type: Array })
|
|
1979
|
+
], h.prototype, "monthStrings", 2);
|
|
1980
|
+
f([
|
|
1981
|
+
y({ type: String })
|
|
1982
|
+
], h.prototype, "weekString", 2);
|
|
1983
|
+
f([
|
|
1984
|
+
y({ type: String })
|
|
1985
|
+
], h.prototype, "prevMonthString", 2);
|
|
1986
|
+
f([
|
|
1987
|
+
y({ type: String })
|
|
1988
|
+
], h.prototype, "nextMonthString", 2);
|
|
1989
|
+
f([
|
|
1990
|
+
y({ type: Array })
|
|
1991
|
+
], h.prototype, "_selected", 2);
|
|
1992
|
+
f([
|
|
1993
|
+
y({ type: Number })
|
|
1994
|
+
], h.prototype, "year", 2);
|
|
1995
|
+
f([
|
|
1996
|
+
y({ type: Number })
|
|
1997
|
+
], h.prototype, "month", 2);
|
|
1998
|
+
f([
|
|
1999
|
+
y({ type: Number })
|
|
2000
|
+
], h.prototype, "week", 2);
|
|
2001
|
+
f([
|
|
2002
|
+
y({ type: Date })
|
|
2003
|
+
], h.prototype, "rangeHovered", 2);
|
|
2004
|
+
f([
|
|
2005
|
+
U()
|
|
2006
|
+
], h.prototype, "inRange", 2);
|
|
2007
|
+
f([
|
|
2008
|
+
U()
|
|
2009
|
+
], h.prototype, "focusedDate", 2);
|
|
2010
|
+
f([
|
|
2011
|
+
U()
|
|
2012
|
+
], h.prototype, "selectableDates", 2);
|
|
2013
|
+
f([
|
|
2014
|
+
U()
|
|
2015
|
+
], h.prototype, "currentmonthtouched", 2);
|
|
2016
|
+
f([
|
|
2017
|
+
U()
|
|
2018
|
+
], h.prototype, "tabIndexSet", 2);
|
|
2019
|
+
h = f([
|
|
2020
|
+
kt("pkt-calendar")
|
|
2021
|
+
], h);
|
|
1970
2022
|
export {
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
2023
|
+
h as P,
|
|
2024
|
+
R as a,
|
|
2025
|
+
ze as b,
|
|
2026
|
+
Ae as c,
|
|
1975
2027
|
p as d,
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
2028
|
+
B as e,
|
|
2029
|
+
Qe as f,
|
|
2030
|
+
Ge as i,
|
|
2031
|
+
E as n,
|
|
2032
|
+
C as p,
|
|
2033
|
+
Xe as s
|
|
1982
2034
|
};
|