@oslokommune/punkt-elements 13.6.6 → 13.6.8
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 +34 -0
- package/dist/{calendar-ChphTIhk.js → calendar-CodWwTHM.js} +503 -471
- package/dist/calendar-DH-fCGyW.cjs +115 -0
- package/dist/{combobox-C_pTRtsQ.js → combobox-DxNotM0u.js} +2 -2
- package/dist/{combobox-CNH-j9Za.cjs → combobox-cK_746ek.cjs} +2 -2
- package/dist/datepicker-BEMo4X9s.js +770 -0
- package/dist/datepicker-n49TAIAt.cjs +169 -0
- package/dist/index.d.ts +7 -1
- package/dist/{listbox-BBO1d5Jd.cjs → listbox-L-iOSF7M.cjs} +2 -2
- package/dist/{listbox-DJ7b3Wmc.js → listbox-n4wjlLqD.js} +10 -10
- package/dist/pkt-calendar.cjs +1 -1
- package/dist/pkt-calendar.js +1 -1
- package/dist/pkt-combobox.cjs +1 -1
- package/dist/pkt-combobox.js +1 -1
- package/dist/pkt-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +1 -1
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +4 -4
- package/dist/pkt-listbox.cjs +1 -1
- package/dist/pkt-listbox.js +1 -1
- package/package.json +2 -2
- package/src/components/calendar/calendar.ts +26 -28
- package/src/components/combobox/combobox.ts +1 -1
- package/src/components/datepicker/date-tags.ts +2 -1
- package/src/components/datepicker/datepicker-utils.ts +475 -0
- package/src/components/datepicker/datepicker.selection.test.ts +62 -1
- package/src/components/datepicker/datepicker.ts +157 -271
- package/src/components/listbox/listbox.ts +1 -1
- package/dist/calendar-CL9O0tLP.cjs +0 -115
- package/dist/datepicker-CV73pLqD.cjs +0 -169
- package/dist/datepicker-Ca552mbJ.js +0 -531
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import { e as
|
|
2
|
-
import { P as
|
|
3
|
-
import { r as
|
|
1
|
+
import { e as J } from "./class-map-Dw6Wrxwi.js";
|
|
2
|
+
import { P as gt, E as z, x as D, n as m, a as yt } from "./element-DJZPsA_J.js";
|
|
3
|
+
import { r as R } from "./state-CPQXJ4Ct.js";
|
|
4
4
|
import "./icon-B1-mkmwB.js";
|
|
5
|
-
const
|
|
6
|
-
function
|
|
7
|
-
return typeof t == "function" ? t(e) : t && typeof t == "object" &&
|
|
5
|
+
const ot = 6048e5, pt = 864e5, K = Symbol.for("constructDateFrom");
|
|
6
|
+
function v(t, e) {
|
|
7
|
+
return typeof t == "function" ? t(e) : t && typeof t == "object" && K in t ? t[K](e) : t instanceof Date ? new t.constructor(e) : new Date(e);
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
return
|
|
9
|
+
function k(t, e) {
|
|
10
|
+
return v(e || t, t);
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
const r =
|
|
14
|
-
return isNaN(e) ?
|
|
12
|
+
function j(t, e, n) {
|
|
13
|
+
const r = k(t, n == null ? void 0 : n.in);
|
|
14
|
+
return isNaN(e) ? v(t, NaN) : (e && r.setDate(r.getDate() + e), r);
|
|
15
15
|
}
|
|
16
|
-
let
|
|
17
|
-
function
|
|
18
|
-
return
|
|
16
|
+
let wt = {};
|
|
17
|
+
function L() {
|
|
18
|
+
return wt;
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
var
|
|
22
|
-
const n =
|
|
20
|
+
function H(t, e) {
|
|
21
|
+
var o, c, h, f;
|
|
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 ?? ((f = (h = n.locale) == null ? void 0 : h.options) == null ? void 0 : f.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
|
-
function
|
|
26
|
-
return
|
|
25
|
+
function q(t, e) {
|
|
26
|
+
return H(t, { ...e, weekStartsOn: 1 });
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
const n =
|
|
28
|
+
function ct(t, e) {
|
|
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
|
-
const s =
|
|
31
|
+
const s = q(a), i = v(n, 0);
|
|
32
32
|
i.setFullYear(r, 0, 4), i.setHours(0, 0, 0, 0);
|
|
33
|
-
const
|
|
34
|
-
return n.getTime() >= s.getTime() ? r + 1 : n.getTime() >=
|
|
33
|
+
const o = q(i);
|
|
34
|
+
return n.getTime() >= s.getTime() ? r + 1 : n.getTime() >= o.getTime() ? r : r - 1;
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
const e =
|
|
36
|
+
function Z(t) {
|
|
37
|
+
const e = k(t), n = new Date(
|
|
38
38
|
Date.UTC(
|
|
39
39
|
e.getFullYear(),
|
|
40
40
|
e.getMonth(),
|
|
@@ -47,59 +47,55 @@ function K(t) {
|
|
|
47
47
|
);
|
|
48
48
|
return n.setUTCFullYear(e.getFullYear()), +t - +n;
|
|
49
49
|
}
|
|
50
|
-
function
|
|
51
|
-
const n =
|
|
50
|
+
function lt(t, ...e) {
|
|
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
|
|
58
|
-
const n =
|
|
57
|
+
function tt(t, e) {
|
|
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 bt(t, e, n) {
|
|
62
|
+
const [r, a] = lt(
|
|
63
63
|
n == null ? void 0 : n.in,
|
|
64
64
|
t,
|
|
65
65
|
e
|
|
66
|
-
), s =
|
|
67
|
-
return Math.round((
|
|
66
|
+
), s = tt(r), i = tt(a), o = +s - Z(s), c = +i - Z(i);
|
|
67
|
+
return Math.round((o - c) / pt);
|
|
68
68
|
}
|
|
69
|
-
function
|
|
70
|
-
const n =
|
|
71
|
-
return r.setFullYear(n, 0, 4), r.setHours(0, 0, 0, 0),
|
|
69
|
+
function kt(t, e) {
|
|
70
|
+
const n = ct(t, e), r = v(t, 0);
|
|
71
|
+
return r.setFullYear(n, 0, 4), r.setHours(0, 0, 0, 0), q(r);
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function Dt(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 St(t) {
|
|
77
|
+
return !(!Dt(t) && typeof t != "number" || isNaN(+k(t)));
|
|
78
78
|
}
|
|
79
|
-
function
|
|
80
|
-
const n =
|
|
81
|
-
return n.setHours(23, 59, 59, 999), n;
|
|
82
|
-
}
|
|
83
|
-
function Dt(t, e) {
|
|
84
|
-
const [n, r] = ot(t, e.start, e.end);
|
|
79
|
+
function vt(t, e) {
|
|
80
|
+
const [n, r] = lt(t, e.start, e.end);
|
|
85
81
|
return { start: n, end: r };
|
|
86
82
|
}
|
|
87
|
-
function
|
|
88
|
-
const { start: n, end: r } =
|
|
83
|
+
function Q(t, e) {
|
|
84
|
+
const { start: n, end: r } = vt(e == null ? void 0 : e.in, t);
|
|
89
85
|
let a = +n > +r;
|
|
90
86
|
const s = a ? +n : +r, i = a ? r : n;
|
|
91
87
|
i.setHours(0, 0, 0, 0);
|
|
92
|
-
let
|
|
93
|
-
const
|
|
88
|
+
let o = 1;
|
|
89
|
+
const c = [];
|
|
94
90
|
for (; +i <= s; )
|
|
95
|
-
|
|
96
|
-
return a ?
|
|
91
|
+
c.push(v(n, i)), i.setDate(i.getDate() + o), i.setHours(0, 0, 0, 0);
|
|
92
|
+
return a ? c.reverse() : c;
|
|
97
93
|
}
|
|
98
|
-
function
|
|
99
|
-
const n =
|
|
94
|
+
function Mt(t, e) {
|
|
95
|
+
const n = k(t, e == null ? void 0 : e.in);
|
|
100
96
|
return n.setFullYear(n.getFullYear(), 0, 1), n.setHours(0, 0, 0, 0), n;
|
|
101
97
|
}
|
|
102
|
-
const
|
|
98
|
+
const Tt = {
|
|
103
99
|
lessThanXSeconds: {
|
|
104
100
|
one: "less than a second",
|
|
105
101
|
other: "less than {{count}} seconds"
|
|
@@ -161,77 +157,77 @@ const vt = {
|
|
|
161
157
|
one: "almost 1 year",
|
|
162
158
|
other: "almost {{count}} years"
|
|
163
159
|
}
|
|
164
|
-
},
|
|
160
|
+
}, xt = (t, e, n) => {
|
|
165
161
|
let r;
|
|
166
|
-
const a =
|
|
162
|
+
const a = Tt[t];
|
|
167
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;
|
|
168
164
|
};
|
|
169
|
-
function
|
|
165
|
+
function G(t) {
|
|
170
166
|
return (e = {}) => {
|
|
171
167
|
const n = e.width ? String(e.width) : t.defaultWidth;
|
|
172
168
|
return t.formats[n] || t.formats[t.defaultWidth];
|
|
173
169
|
};
|
|
174
170
|
}
|
|
175
|
-
const
|
|
171
|
+
const Ot = {
|
|
176
172
|
full: "EEEE, MMMM do, y",
|
|
177
173
|
long: "MMMM do, y",
|
|
178
174
|
medium: "MMM d, y",
|
|
179
175
|
short: "MM/dd/yyyy"
|
|
180
|
-
},
|
|
176
|
+
}, Pt = {
|
|
181
177
|
full: "h:mm:ss a zzzz",
|
|
182
178
|
long: "h:mm:ss a z",
|
|
183
179
|
medium: "h:mm:ss a",
|
|
184
180
|
short: "h:mm a"
|
|
185
|
-
},
|
|
181
|
+
}, Nt = {
|
|
186
182
|
full: "{{date}} 'at' {{time}}",
|
|
187
183
|
long: "{{date}} 'at' {{time}}",
|
|
188
184
|
medium: "{{date}}, {{time}}",
|
|
189
185
|
short: "{{date}}, {{time}}"
|
|
190
|
-
},
|
|
191
|
-
date:
|
|
192
|
-
formats:
|
|
186
|
+
}, $t = {
|
|
187
|
+
date: G({
|
|
188
|
+
formats: Ot,
|
|
193
189
|
defaultWidth: "full"
|
|
194
190
|
}),
|
|
195
|
-
time:
|
|
196
|
-
formats:
|
|
191
|
+
time: G({
|
|
192
|
+
formats: Pt,
|
|
197
193
|
defaultWidth: "full"
|
|
198
194
|
}),
|
|
199
|
-
dateTime:
|
|
200
|
-
formats:
|
|
195
|
+
dateTime: G({
|
|
196
|
+
formats: Nt,
|
|
201
197
|
defaultWidth: "full"
|
|
202
198
|
})
|
|
203
|
-
},
|
|
199
|
+
}, Ct = {
|
|
204
200
|
lastWeek: "'last' eeee 'at' p",
|
|
205
201
|
yesterday: "'yesterday at' p",
|
|
206
202
|
today: "'today at' p",
|
|
207
203
|
tomorrow: "'tomorrow at' p",
|
|
208
204
|
nextWeek: "eeee 'at' p",
|
|
209
205
|
other: "P"
|
|
210
|
-
},
|
|
206
|
+
}, _t = (t, e, n, r) => Ct[t];
|
|
211
207
|
function E(t) {
|
|
212
208
|
return (e, n) => {
|
|
213
209
|
const r = n != null && n.context ? String(n.context) : "standalone";
|
|
214
210
|
let a;
|
|
215
211
|
if (r === "formatting" && t.formattingValues) {
|
|
216
|
-
const i = t.defaultFormattingWidth || t.defaultWidth,
|
|
217
|
-
a = t.formattingValues[
|
|
212
|
+
const i = t.defaultFormattingWidth || t.defaultWidth, o = n != null && n.width ? String(n.width) : i;
|
|
213
|
+
a = t.formattingValues[o] || t.formattingValues[i];
|
|
218
214
|
} else {
|
|
219
|
-
const i = t.defaultWidth,
|
|
220
|
-
a = t.values[
|
|
215
|
+
const i = t.defaultWidth, o = n != null && n.width ? String(n.width) : t.defaultWidth;
|
|
216
|
+
a = t.values[o] || t.values[i];
|
|
221
217
|
}
|
|
222
218
|
const s = t.argumentCallback ? t.argumentCallback(e) : e;
|
|
223
219
|
return a[s];
|
|
224
220
|
};
|
|
225
221
|
}
|
|
226
|
-
const
|
|
222
|
+
const Et = {
|
|
227
223
|
narrow: ["B", "A"],
|
|
228
224
|
abbreviated: ["BC", "AD"],
|
|
229
225
|
wide: ["Before Christ", "Anno Domini"]
|
|
230
|
-
},
|
|
226
|
+
}, Wt = {
|
|
231
227
|
narrow: ["1", "2", "3", "4"],
|
|
232
228
|
abbreviated: ["Q1", "Q2", "Q3", "Q4"],
|
|
233
229
|
wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
|
|
234
|
-
},
|
|
230
|
+
}, Yt = {
|
|
235
231
|
narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
|
|
236
232
|
abbreviated: [
|
|
237
233
|
"Jan",
|
|
@@ -261,7 +257,7 @@ const Ct = {
|
|
|
261
257
|
"November",
|
|
262
258
|
"December"
|
|
263
259
|
]
|
|
264
|
-
},
|
|
260
|
+
}, At = {
|
|
265
261
|
narrow: ["S", "M", "T", "W", "T", "F", "S"],
|
|
266
262
|
short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
|
|
267
263
|
abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
|
|
@@ -274,7 +270,7 @@ const Ct = {
|
|
|
274
270
|
"Friday",
|
|
275
271
|
"Saturday"
|
|
276
272
|
]
|
|
277
|
-
},
|
|
273
|
+
}, Ft = {
|
|
278
274
|
narrow: {
|
|
279
275
|
am: "a",
|
|
280
276
|
pm: "p",
|
|
@@ -305,7 +301,7 @@ const Ct = {
|
|
|
305
301
|
evening: "evening",
|
|
306
302
|
night: "night"
|
|
307
303
|
}
|
|
308
|
-
},
|
|
304
|
+
}, Ht = {
|
|
309
305
|
narrow: {
|
|
310
306
|
am: "a",
|
|
311
307
|
pm: "p",
|
|
@@ -336,7 +332,7 @@ const Ct = {
|
|
|
336
332
|
evening: "in the evening",
|
|
337
333
|
night: "at night"
|
|
338
334
|
}
|
|
339
|
-
},
|
|
335
|
+
}, It = (t, e) => {
|
|
340
336
|
const n = Number(t), r = n % 100;
|
|
341
337
|
if (r > 20 || r < 10)
|
|
342
338
|
switch (r % 10) {
|
|
@@ -348,29 +344,29 @@ const Ct = {
|
|
|
348
344
|
return n + "rd";
|
|
349
345
|
}
|
|
350
346
|
return n + "th";
|
|
351
|
-
},
|
|
352
|
-
ordinalNumber:
|
|
347
|
+
}, Rt = {
|
|
348
|
+
ordinalNumber: It,
|
|
353
349
|
era: E({
|
|
354
|
-
values:
|
|
350
|
+
values: Et,
|
|
355
351
|
defaultWidth: "wide"
|
|
356
352
|
}),
|
|
357
353
|
quarter: E({
|
|
358
|
-
values:
|
|
354
|
+
values: Wt,
|
|
359
355
|
defaultWidth: "wide",
|
|
360
356
|
argumentCallback: (t) => t - 1
|
|
361
357
|
}),
|
|
362
358
|
month: E({
|
|
363
|
-
values:
|
|
359
|
+
values: Yt,
|
|
364
360
|
defaultWidth: "wide"
|
|
365
361
|
}),
|
|
366
362
|
day: E({
|
|
367
|
-
values:
|
|
363
|
+
values: At,
|
|
368
364
|
defaultWidth: "wide"
|
|
369
365
|
}),
|
|
370
366
|
dayPeriod: E({
|
|
371
|
-
values:
|
|
367
|
+
values: Ft,
|
|
372
368
|
defaultWidth: "wide",
|
|
373
|
-
formattingValues:
|
|
369
|
+
formattingValues: Ht,
|
|
374
370
|
defaultFormattingWidth: "wide"
|
|
375
371
|
})
|
|
376
372
|
};
|
|
@@ -379,30 +375,30 @@ function W(t) {
|
|
|
379
375
|
const r = n.width, a = r && t.matchPatterns[r] || t.matchPatterns[t.defaultMatchWidth], s = e.match(a);
|
|
380
376
|
if (!s)
|
|
381
377
|
return null;
|
|
382
|
-
const i = s[0],
|
|
378
|
+
const i = s[0], o = r && t.parsePatterns[r] || t.parsePatterns[t.defaultParseWidth], c = Array.isArray(o) ? Lt(o, (y) => y.test(i)) : (
|
|
383
379
|
// [TODO] -- I challenge you to fix the type
|
|
384
|
-
|
|
380
|
+
qt(o, (y) => y.test(i))
|
|
385
381
|
);
|
|
386
|
-
let
|
|
387
|
-
|
|
382
|
+
let h;
|
|
383
|
+
h = t.valueCallback ? t.valueCallback(c) : c, h = n.valueCallback ? (
|
|
388
384
|
// [TODO] -- I challenge you to fix the type
|
|
389
|
-
n.valueCallback(
|
|
390
|
-
) :
|
|
385
|
+
n.valueCallback(h)
|
|
386
|
+
) : h;
|
|
391
387
|
const f = e.slice(i.length);
|
|
392
|
-
return { value:
|
|
388
|
+
return { value: h, rest: f };
|
|
393
389
|
};
|
|
394
390
|
}
|
|
395
|
-
function
|
|
391
|
+
function qt(t, e) {
|
|
396
392
|
for (const n in t)
|
|
397
393
|
if (Object.prototype.hasOwnProperty.call(t, n) && e(t[n]))
|
|
398
394
|
return n;
|
|
399
395
|
}
|
|
400
|
-
function
|
|
396
|
+
function Lt(t, e) {
|
|
401
397
|
for (let n = 0; n < t.length; n++)
|
|
402
398
|
if (e(t[n]))
|
|
403
399
|
return n;
|
|
404
400
|
}
|
|
405
|
-
function
|
|
401
|
+
function Ut(t) {
|
|
406
402
|
return (e, n = {}) => {
|
|
407
403
|
const r = e.match(t.matchPattern);
|
|
408
404
|
if (!r) return null;
|
|
@@ -410,27 +406,27 @@ function Lt(t) {
|
|
|
410
406
|
if (!s) return null;
|
|
411
407
|
let i = t.valueCallback ? t.valueCallback(s[0]) : s[0];
|
|
412
408
|
i = n.valueCallback ? n.valueCallback(i) : i;
|
|
413
|
-
const
|
|
414
|
-
return { value: i, rest:
|
|
409
|
+
const o = e.slice(a.length);
|
|
410
|
+
return { value: i, rest: o };
|
|
415
411
|
};
|
|
416
412
|
}
|
|
417
|
-
const
|
|
413
|
+
const Bt = /^(\d+)(th|st|nd|rd)?/i, zt = /\d+/i, jt = {
|
|
418
414
|
narrow: /^(b|a)/i,
|
|
419
415
|
abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
|
|
420
416
|
wide: /^(before christ|before common era|anno domini|common era)/i
|
|
421
|
-
}, zt = {
|
|
422
|
-
any: [/^b/i, /^(a|c)/i]
|
|
423
417
|
}, Qt = {
|
|
418
|
+
any: [/^b/i, /^(a|c)/i]
|
|
419
|
+
}, Gt = {
|
|
424
420
|
narrow: /^[1234]/i,
|
|
425
421
|
abbreviated: /^q[1234]/i,
|
|
426
422
|
wide: /^[1234](th|st|nd|rd)? quarter/i
|
|
427
|
-
},
|
|
423
|
+
}, Xt = {
|
|
428
424
|
any: [/1/i, /2/i, /3/i, /4/i]
|
|
429
|
-
},
|
|
425
|
+
}, Vt = {
|
|
430
426
|
narrow: /^[jfmasond]/i,
|
|
431
427
|
abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
|
|
432
428
|
wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
|
|
433
|
-
},
|
|
429
|
+
}, Jt = {
|
|
434
430
|
narrow: [
|
|
435
431
|
/^j/i,
|
|
436
432
|
/^f/i,
|
|
@@ -459,18 +455,18 @@ const Rt = /^(\d+)(th|st|nd|rd)?/i, Ut = /\d+/i, Bt = {
|
|
|
459
455
|
/^n/i,
|
|
460
456
|
/^d/i
|
|
461
457
|
]
|
|
462
|
-
},
|
|
458
|
+
}, Kt = {
|
|
463
459
|
narrow: /^[smtwf]/i,
|
|
464
460
|
short: /^(su|mo|tu|we|th|fr|sa)/i,
|
|
465
461
|
abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
|
|
466
462
|
wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
|
|
467
|
-
},
|
|
463
|
+
}, Zt = {
|
|
468
464
|
narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
|
|
469
465
|
any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
|
|
470
|
-
},
|
|
466
|
+
}, te = {
|
|
471
467
|
narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
|
|
472
468
|
any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
|
|
473
|
-
},
|
|
469
|
+
}, ee = {
|
|
474
470
|
any: {
|
|
475
471
|
am: /^a/i,
|
|
476
472
|
pm: /^p/i,
|
|
@@ -481,99 +477,99 @@ const Rt = /^(\d+)(th|st|nd|rd)?/i, Ut = /\d+/i, Bt = {
|
|
|
481
477
|
evening: /evening/i,
|
|
482
478
|
night: /night/i
|
|
483
479
|
}
|
|
484
|
-
},
|
|
485
|
-
ordinalNumber:
|
|
486
|
-
matchPattern:
|
|
487
|
-
parsePattern:
|
|
480
|
+
}, ne = {
|
|
481
|
+
ordinalNumber: Ut({
|
|
482
|
+
matchPattern: Bt,
|
|
483
|
+
parsePattern: zt,
|
|
488
484
|
valueCallback: (t) => parseInt(t, 10)
|
|
489
485
|
}),
|
|
490
486
|
era: W({
|
|
491
|
-
matchPatterns:
|
|
487
|
+
matchPatterns: jt,
|
|
492
488
|
defaultMatchWidth: "wide",
|
|
493
|
-
parsePatterns:
|
|
489
|
+
parsePatterns: Qt,
|
|
494
490
|
defaultParseWidth: "any"
|
|
495
491
|
}),
|
|
496
492
|
quarter: W({
|
|
497
|
-
matchPatterns:
|
|
493
|
+
matchPatterns: Gt,
|
|
498
494
|
defaultMatchWidth: "wide",
|
|
499
|
-
parsePatterns:
|
|
495
|
+
parsePatterns: Xt,
|
|
500
496
|
defaultParseWidth: "any",
|
|
501
497
|
valueCallback: (t) => t + 1
|
|
502
498
|
}),
|
|
503
499
|
month: W({
|
|
504
|
-
matchPatterns:
|
|
500
|
+
matchPatterns: Vt,
|
|
505
501
|
defaultMatchWidth: "wide",
|
|
506
|
-
parsePatterns:
|
|
502
|
+
parsePatterns: Jt,
|
|
507
503
|
defaultParseWidth: "any"
|
|
508
504
|
}),
|
|
509
505
|
day: W({
|
|
510
|
-
matchPatterns:
|
|
506
|
+
matchPatterns: Kt,
|
|
511
507
|
defaultMatchWidth: "wide",
|
|
512
|
-
parsePatterns:
|
|
508
|
+
parsePatterns: Zt,
|
|
513
509
|
defaultParseWidth: "any"
|
|
514
510
|
}),
|
|
515
511
|
dayPeriod: W({
|
|
516
|
-
matchPatterns:
|
|
512
|
+
matchPatterns: te,
|
|
517
513
|
defaultMatchWidth: "any",
|
|
518
|
-
parsePatterns:
|
|
514
|
+
parsePatterns: ee,
|
|
519
515
|
defaultParseWidth: "any"
|
|
520
516
|
})
|
|
521
|
-
},
|
|
517
|
+
}, re = {
|
|
522
518
|
code: "en-US",
|
|
523
|
-
formatDistance:
|
|
524
|
-
formatLong:
|
|
525
|
-
formatRelative:
|
|
526
|
-
localize:
|
|
527
|
-
match:
|
|
519
|
+
formatDistance: xt,
|
|
520
|
+
formatLong: $t,
|
|
521
|
+
formatRelative: _t,
|
|
522
|
+
localize: Rt,
|
|
523
|
+
match: ne,
|
|
528
524
|
options: {
|
|
529
525
|
weekStartsOn: 0,
|
|
530
526
|
firstWeekContainsDate: 1
|
|
531
527
|
}
|
|
532
528
|
};
|
|
533
|
-
function
|
|
534
|
-
const n =
|
|
535
|
-
return
|
|
529
|
+
function ae(t, e) {
|
|
530
|
+
const n = k(t, e == null ? void 0 : e.in);
|
|
531
|
+
return bt(n, Mt(n)) + 1;
|
|
536
532
|
}
|
|
537
|
-
function
|
|
538
|
-
const n =
|
|
539
|
-
return Math.round(r /
|
|
533
|
+
function se(t, e) {
|
|
534
|
+
const n = k(t, e == null ? void 0 : e.in), r = +q(n) - +kt(n);
|
|
535
|
+
return Math.round(r / ot) + 1;
|
|
540
536
|
}
|
|
541
|
-
function
|
|
542
|
-
var f,
|
|
543
|
-
const n =
|
|
537
|
+
function ut(t, e) {
|
|
538
|
+
var f, y, g, M;
|
|
539
|
+
const n = k(t, e == null ? void 0 : e.in), r = n.getFullYear(), a = L(), s = (e == null ? void 0 : e.firstWeekContainsDate) ?? ((y = (f = e == null ? void 0 : e.locale) == null ? void 0 : f.options) == null ? void 0 : y.firstWeekContainsDate) ?? a.firstWeekContainsDate ?? ((M = (g = a.locale) == null ? void 0 : g.options) == null ? void 0 : M.firstWeekContainsDate) ?? 1, i = v((e == null ? void 0 : e.in) || t, 0);
|
|
544
540
|
i.setFullYear(r + 1, 0, s), i.setHours(0, 0, 0, 0);
|
|
545
|
-
const
|
|
546
|
-
|
|
547
|
-
const
|
|
548
|
-
return +n >= +
|
|
541
|
+
const o = H(i, e), c = v((e == null ? void 0 : e.in) || t, 0);
|
|
542
|
+
c.setFullYear(r, 0, s), c.setHours(0, 0, 0, 0);
|
|
543
|
+
const h = H(c, e);
|
|
544
|
+
return +n >= +o ? r + 1 : +n >= +h ? r : r - 1;
|
|
549
545
|
}
|
|
550
|
-
function
|
|
551
|
-
var
|
|
552
|
-
const n =
|
|
553
|
-
return s.setFullYear(a, 0, r), s.setHours(0, 0, 0, 0),
|
|
546
|
+
function ie(t, e) {
|
|
547
|
+
var o, c, h, f;
|
|
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 ?? ((f = (h = n.locale) == null ? void 0 : h.options) == null ? void 0 : f.firstWeekContainsDate) ?? 1, a = ut(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), H(s, e);
|
|
554
550
|
}
|
|
555
|
-
function
|
|
556
|
-
const n =
|
|
557
|
-
return Math.round(r /
|
|
551
|
+
function ht(t, e) {
|
|
552
|
+
const n = k(t, e == null ? void 0 : e.in), r = +H(n, e) - +ie(n, e);
|
|
553
|
+
return Math.round(r / ot) + 1;
|
|
558
554
|
}
|
|
559
|
-
function
|
|
555
|
+
function l(t, e) {
|
|
560
556
|
const n = t < 0 ? "-" : "", r = Math.abs(t).toString().padStart(e, "0");
|
|
561
557
|
return n + r;
|
|
562
558
|
}
|
|
563
|
-
const
|
|
559
|
+
const T = {
|
|
564
560
|
// Year
|
|
565
561
|
y(t, e) {
|
|
566
562
|
const n = t.getFullYear(), r = n > 0 ? n : 1 - n;
|
|
567
|
-
return
|
|
563
|
+
return l(e === "yy" ? r % 100 : r, e.length);
|
|
568
564
|
},
|
|
569
565
|
// Month
|
|
570
566
|
M(t, e) {
|
|
571
567
|
const n = t.getMonth();
|
|
572
|
-
return e === "M" ? String(n + 1) :
|
|
568
|
+
return e === "M" ? String(n + 1) : l(n + 1, 2);
|
|
573
569
|
},
|
|
574
570
|
// Day of the month
|
|
575
571
|
d(t, e) {
|
|
576
|
-
return
|
|
572
|
+
return l(t.getDate(), e.length);
|
|
577
573
|
},
|
|
578
574
|
// AM or PM
|
|
579
575
|
a(t, e) {
|
|
@@ -593,26 +589,26 @@ const x = {
|
|
|
593
589
|
},
|
|
594
590
|
// Hour [1-12]
|
|
595
591
|
h(t, e) {
|
|
596
|
-
return
|
|
592
|
+
return l(t.getHours() % 12 || 12, e.length);
|
|
597
593
|
},
|
|
598
594
|
// Hour [0-23]
|
|
599
595
|
H(t, e) {
|
|
600
|
-
return
|
|
596
|
+
return l(t.getHours(), e.length);
|
|
601
597
|
},
|
|
602
598
|
// Minute
|
|
603
599
|
m(t, e) {
|
|
604
|
-
return
|
|
600
|
+
return l(t.getMinutes(), e.length);
|
|
605
601
|
},
|
|
606
602
|
// Second
|
|
607
603
|
s(t, e) {
|
|
608
|
-
return
|
|
604
|
+
return l(t.getSeconds(), e.length);
|
|
609
605
|
},
|
|
610
606
|
// Fraction of second
|
|
611
607
|
S(t, e) {
|
|
612
608
|
const n = e.length, r = t.getMilliseconds(), a = Math.trunc(
|
|
613
609
|
r * Math.pow(10, n - 3)
|
|
614
610
|
);
|
|
615
|
-
return
|
|
611
|
+
return l(a, e.length);
|
|
616
612
|
}
|
|
617
613
|
}, C = {
|
|
618
614
|
midnight: "midnight",
|
|
@@ -621,7 +617,7 @@ const x = {
|
|
|
621
617
|
afternoon: "afternoon",
|
|
622
618
|
evening: "evening",
|
|
623
619
|
night: "night"
|
|
624
|
-
},
|
|
620
|
+
}, et = {
|
|
625
621
|
// Era
|
|
626
622
|
G: function(t, e, n) {
|
|
627
623
|
const r = t.getFullYear() > 0 ? 1 : 0;
|
|
@@ -643,21 +639,21 @@ const x = {
|
|
|
643
639
|
const r = t.getFullYear(), a = r > 0 ? r : 1 - r;
|
|
644
640
|
return n.ordinalNumber(a, { unit: "year" });
|
|
645
641
|
}
|
|
646
|
-
return
|
|
642
|
+
return T.y(t, e);
|
|
647
643
|
},
|
|
648
644
|
// Local week-numbering year
|
|
649
645
|
Y: function(t, e, n, r) {
|
|
650
|
-
const a =
|
|
646
|
+
const a = ut(t, r), s = a > 0 ? a : 1 - a;
|
|
651
647
|
if (e === "YY") {
|
|
652
648
|
const i = s % 100;
|
|
653
|
-
return
|
|
649
|
+
return l(i, 2);
|
|
654
650
|
}
|
|
655
|
-
return e === "Yo" ? n.ordinalNumber(s, { unit: "year" }) :
|
|
651
|
+
return e === "Yo" ? n.ordinalNumber(s, { unit: "year" }) : l(s, e.length);
|
|
656
652
|
},
|
|
657
653
|
// ISO week-numbering year
|
|
658
654
|
R: function(t, e) {
|
|
659
|
-
const n =
|
|
660
|
-
return
|
|
655
|
+
const n = ct(t);
|
|
656
|
+
return l(n, e.length);
|
|
661
657
|
},
|
|
662
658
|
// Extended year. This is a single number designating the year of this calendar system.
|
|
663
659
|
// The main difference between `y` and `u` localizers are B.C. years:
|
|
@@ -670,7 +666,7 @@ const x = {
|
|
|
670
666
|
// while `uu` pads single digit years to 2 characters and returns other years unchanged.
|
|
671
667
|
u: function(t, e) {
|
|
672
668
|
const n = t.getFullYear();
|
|
673
|
-
return
|
|
669
|
+
return l(n, e.length);
|
|
674
670
|
},
|
|
675
671
|
// Quarter
|
|
676
672
|
Q: function(t, e, n) {
|
|
@@ -679,7 +675,7 @@ const x = {
|
|
|
679
675
|
case "Q":
|
|
680
676
|
return String(r);
|
|
681
677
|
case "QQ":
|
|
682
|
-
return
|
|
678
|
+
return l(r, 2);
|
|
683
679
|
case "Qo":
|
|
684
680
|
return n.ordinalNumber(r, { unit: "quarter" });
|
|
685
681
|
case "QQQ":
|
|
@@ -707,7 +703,7 @@ const x = {
|
|
|
707
703
|
case "q":
|
|
708
704
|
return String(r);
|
|
709
705
|
case "qq":
|
|
710
|
-
return
|
|
706
|
+
return l(r, 2);
|
|
711
707
|
case "qo":
|
|
712
708
|
return n.ordinalNumber(r, { unit: "quarter" });
|
|
713
709
|
case "qqq":
|
|
@@ -734,7 +730,7 @@ const x = {
|
|
|
734
730
|
switch (e) {
|
|
735
731
|
case "M":
|
|
736
732
|
case "MM":
|
|
737
|
-
return
|
|
733
|
+
return T.M(t, e);
|
|
738
734
|
case "Mo":
|
|
739
735
|
return n.ordinalNumber(r + 1, { unit: "month" });
|
|
740
736
|
case "MMM":
|
|
@@ -759,7 +755,7 @@ const x = {
|
|
|
759
755
|
case "L":
|
|
760
756
|
return String(r + 1);
|
|
761
757
|
case "LL":
|
|
762
|
-
return
|
|
758
|
+
return l(r + 1, 2);
|
|
763
759
|
case "Lo":
|
|
764
760
|
return n.ordinalNumber(r + 1, { unit: "month" });
|
|
765
761
|
case "LLL":
|
|
@@ -779,22 +775,22 @@ const x = {
|
|
|
779
775
|
},
|
|
780
776
|
// Local week of year
|
|
781
777
|
w: function(t, e, n, r) {
|
|
782
|
-
const a =
|
|
783
|
-
return e === "wo" ? n.ordinalNumber(a, { unit: "week" }) :
|
|
778
|
+
const a = ht(t, r);
|
|
779
|
+
return e === "wo" ? n.ordinalNumber(a, { unit: "week" }) : l(a, e.length);
|
|
784
780
|
},
|
|
785
781
|
// ISO week of year
|
|
786
782
|
I: function(t, e, n) {
|
|
787
|
-
const r =
|
|
788
|
-
return e === "Io" ? n.ordinalNumber(r, { unit: "week" }) :
|
|
783
|
+
const r = se(t);
|
|
784
|
+
return e === "Io" ? n.ordinalNumber(r, { unit: "week" }) : l(r, e.length);
|
|
789
785
|
},
|
|
790
786
|
// Day of the month
|
|
791
787
|
d: function(t, e, n) {
|
|
792
|
-
return e === "do" ? n.ordinalNumber(t.getDate(), { unit: "date" }) :
|
|
788
|
+
return e === "do" ? n.ordinalNumber(t.getDate(), { unit: "date" }) : T.d(t, e);
|
|
793
789
|
},
|
|
794
790
|
// Day of year
|
|
795
791
|
D: function(t, e, n) {
|
|
796
|
-
const r =
|
|
797
|
-
return e === "Do" ? n.ordinalNumber(r, { unit: "dayOfYear" }) :
|
|
792
|
+
const r = ae(t);
|
|
793
|
+
return e === "Do" ? n.ordinalNumber(r, { unit: "dayOfYear" }) : l(r, e.length);
|
|
798
794
|
},
|
|
799
795
|
// Day of week
|
|
800
796
|
E: function(t, e, n) {
|
|
@@ -832,7 +828,7 @@ const x = {
|
|
|
832
828
|
case "e":
|
|
833
829
|
return String(s);
|
|
834
830
|
case "ee":
|
|
835
|
-
return
|
|
831
|
+
return l(s, 2);
|
|
836
832
|
case "eo":
|
|
837
833
|
return n.ordinalNumber(s, { unit: "day" });
|
|
838
834
|
case "eee":
|
|
@@ -865,7 +861,7 @@ const x = {
|
|
|
865
861
|
case "c":
|
|
866
862
|
return String(s);
|
|
867
863
|
case "cc":
|
|
868
|
-
return
|
|
864
|
+
return l(s, e.length);
|
|
869
865
|
case "co":
|
|
870
866
|
return n.ordinalNumber(s, { unit: "day" });
|
|
871
867
|
case "ccc":
|
|
@@ -898,7 +894,7 @@ const x = {
|
|
|
898
894
|
case "i":
|
|
899
895
|
return String(a);
|
|
900
896
|
case "ii":
|
|
901
|
-
return
|
|
897
|
+
return l(a, e.length);
|
|
902
898
|
case "io":
|
|
903
899
|
return n.ordinalNumber(a, { unit: "day" });
|
|
904
900
|
case "iii":
|
|
@@ -1012,33 +1008,33 @@ const x = {
|
|
|
1012
1008
|
let r = t.getHours() % 12;
|
|
1013
1009
|
return r === 0 && (r = 12), n.ordinalNumber(r, { unit: "hour" });
|
|
1014
1010
|
}
|
|
1015
|
-
return
|
|
1011
|
+
return T.h(t, e);
|
|
1016
1012
|
},
|
|
1017
1013
|
// Hour [0-23]
|
|
1018
1014
|
H: function(t, e, n) {
|
|
1019
|
-
return e === "Ho" ? n.ordinalNumber(t.getHours(), { unit: "hour" }) :
|
|
1015
|
+
return e === "Ho" ? n.ordinalNumber(t.getHours(), { unit: "hour" }) : T.H(t, e);
|
|
1020
1016
|
},
|
|
1021
1017
|
// Hour [0-11]
|
|
1022
1018
|
K: function(t, e, n) {
|
|
1023
1019
|
const r = t.getHours() % 12;
|
|
1024
|
-
return e === "Ko" ? n.ordinalNumber(r, { unit: "hour" }) :
|
|
1020
|
+
return e === "Ko" ? n.ordinalNumber(r, { unit: "hour" }) : l(r, e.length);
|
|
1025
1021
|
},
|
|
1026
1022
|
// Hour [1-24]
|
|
1027
1023
|
k: function(t, e, n) {
|
|
1028
1024
|
let r = t.getHours();
|
|
1029
|
-
return r === 0 && (r = 24), e === "ko" ? n.ordinalNumber(r, { unit: "hour" }) :
|
|
1025
|
+
return r === 0 && (r = 24), e === "ko" ? n.ordinalNumber(r, { unit: "hour" }) : l(r, e.length);
|
|
1030
1026
|
},
|
|
1031
1027
|
// Minute
|
|
1032
1028
|
m: function(t, e, n) {
|
|
1033
|
-
return e === "mo" ? n.ordinalNumber(t.getMinutes(), { unit: "minute" }) :
|
|
1029
|
+
return e === "mo" ? n.ordinalNumber(t.getMinutes(), { unit: "minute" }) : T.m(t, e);
|
|
1034
1030
|
},
|
|
1035
1031
|
// Second
|
|
1036
1032
|
s: function(t, e, n) {
|
|
1037
|
-
return e === "so" ? n.ordinalNumber(t.getSeconds(), { unit: "second" }) :
|
|
1033
|
+
return e === "so" ? n.ordinalNumber(t.getSeconds(), { unit: "second" }) : T.s(t, e);
|
|
1038
1034
|
},
|
|
1039
1035
|
// Fraction of second
|
|
1040
1036
|
S: function(t, e) {
|
|
1041
|
-
return
|
|
1037
|
+
return T.S(t, e);
|
|
1042
1038
|
},
|
|
1043
1039
|
// Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
|
|
1044
1040
|
X: function(t, e, n) {
|
|
@@ -1047,14 +1043,14 @@ const x = {
|
|
|
1047
1043
|
return "Z";
|
|
1048
1044
|
switch (e) {
|
|
1049
1045
|
case "X":
|
|
1050
|
-
return
|
|
1046
|
+
return rt(r);
|
|
1051
1047
|
case "XXXX":
|
|
1052
1048
|
case "XX":
|
|
1053
|
-
return
|
|
1049
|
+
return N(r);
|
|
1054
1050
|
case "XXXXX":
|
|
1055
1051
|
case "XXX":
|
|
1056
1052
|
default:
|
|
1057
|
-
return
|
|
1053
|
+
return N(r, ":");
|
|
1058
1054
|
}
|
|
1059
1055
|
},
|
|
1060
1056
|
// Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
|
|
@@ -1062,14 +1058,14 @@ const x = {
|
|
|
1062
1058
|
const r = t.getTimezoneOffset();
|
|
1063
1059
|
switch (e) {
|
|
1064
1060
|
case "x":
|
|
1065
|
-
return
|
|
1061
|
+
return rt(r);
|
|
1066
1062
|
case "xxxx":
|
|
1067
1063
|
case "xx":
|
|
1068
|
-
return
|
|
1064
|
+
return N(r);
|
|
1069
1065
|
case "xxxxx":
|
|
1070
1066
|
case "xxx":
|
|
1071
1067
|
default:
|
|
1072
|
-
return
|
|
1068
|
+
return N(r, ":");
|
|
1073
1069
|
}
|
|
1074
1070
|
},
|
|
1075
1071
|
// Timezone (GMT)
|
|
@@ -1079,10 +1075,10 @@ const x = {
|
|
|
1079
1075
|
case "O":
|
|
1080
1076
|
case "OO":
|
|
1081
1077
|
case "OOO":
|
|
1082
|
-
return "GMT" +
|
|
1078
|
+
return "GMT" + nt(r, ":");
|
|
1083
1079
|
case "OOOO":
|
|
1084
1080
|
default:
|
|
1085
|
-
return "GMT" +
|
|
1081
|
+
return "GMT" + N(r, ":");
|
|
1086
1082
|
}
|
|
1087
1083
|
},
|
|
1088
1084
|
// Timezone (specific non-location)
|
|
@@ -1092,34 +1088,34 @@ const x = {
|
|
|
1092
1088
|
case "z":
|
|
1093
1089
|
case "zz":
|
|
1094
1090
|
case "zzz":
|
|
1095
|
-
return "GMT" +
|
|
1091
|
+
return "GMT" + nt(r, ":");
|
|
1096
1092
|
case "zzzz":
|
|
1097
1093
|
default:
|
|
1098
|
-
return "GMT" +
|
|
1094
|
+
return "GMT" + N(r, ":");
|
|
1099
1095
|
}
|
|
1100
1096
|
},
|
|
1101
1097
|
// Seconds timestamp
|
|
1102
1098
|
t: function(t, e, n) {
|
|
1103
1099
|
const r = Math.trunc(+t / 1e3);
|
|
1104
|
-
return
|
|
1100
|
+
return l(r, e.length);
|
|
1105
1101
|
},
|
|
1106
1102
|
// Milliseconds timestamp
|
|
1107
1103
|
T: function(t, e, n) {
|
|
1108
|
-
return
|
|
1104
|
+
return l(+t, e.length);
|
|
1109
1105
|
}
|
|
1110
1106
|
};
|
|
1111
|
-
function
|
|
1107
|
+
function nt(t, e = "") {
|
|
1112
1108
|
const n = t > 0 ? "-" : "+", r = Math.abs(t), a = Math.trunc(r / 60), s = r % 60;
|
|
1113
|
-
return s === 0 ? n + String(a) : n + String(a) + e +
|
|
1109
|
+
return s === 0 ? n + String(a) : n + String(a) + e + l(s, 2);
|
|
1114
1110
|
}
|
|
1115
|
-
function
|
|
1116
|
-
return t % 60 === 0 ? (t > 0 ? "-" : "+") +
|
|
1111
|
+
function rt(t, e) {
|
|
1112
|
+
return t % 60 === 0 ? (t > 0 ? "-" : "+") + l(Math.abs(t) / 60, 2) : N(t, e);
|
|
1117
1113
|
}
|
|
1118
|
-
function
|
|
1119
|
-
const n = t > 0 ? "-" : "+", r = Math.abs(t), a =
|
|
1114
|
+
function N(t, e = "") {
|
|
1115
|
+
const n = t > 0 ? "-" : "+", r = Math.abs(t), a = l(Math.trunc(r / 60), 2), s = l(r % 60, 2);
|
|
1120
1116
|
return n + a + e + s;
|
|
1121
1117
|
}
|
|
1122
|
-
const
|
|
1118
|
+
const at = (t, e) => {
|
|
1123
1119
|
switch (t) {
|
|
1124
1120
|
case "P":
|
|
1125
1121
|
return e.date({ width: "short" });
|
|
@@ -1131,7 +1127,7 @@ const nt = (t, e) => {
|
|
|
1131
1127
|
default:
|
|
1132
1128
|
return e.date({ width: "full" });
|
|
1133
1129
|
}
|
|
1134
|
-
},
|
|
1130
|
+
}, dt = (t, e) => {
|
|
1135
1131
|
switch (t) {
|
|
1136
1132
|
case "p":
|
|
1137
1133
|
return e.time({ width: "short" });
|
|
@@ -1143,10 +1139,10 @@ const nt = (t, e) => {
|
|
|
1143
1139
|
default:
|
|
1144
1140
|
return e.time({ width: "full" });
|
|
1145
1141
|
}
|
|
1146
|
-
},
|
|
1142
|
+
}, oe = (t, e) => {
|
|
1147
1143
|
const n = t.match(/(P+)(p+)?/) || [], r = n[1], a = n[2];
|
|
1148
1144
|
if (!a)
|
|
1149
|
-
return
|
|
1145
|
+
return at(t, e);
|
|
1150
1146
|
let s;
|
|
1151
1147
|
switch (r) {
|
|
1152
1148
|
case "P":
|
|
@@ -1163,106 +1159,106 @@ const nt = (t, e) => {
|
|
|
1163
1159
|
s = e.dateTime({ width: "full" });
|
|
1164
1160
|
break;
|
|
1165
1161
|
}
|
|
1166
|
-
return s.replace("{{date}}",
|
|
1167
|
-
},
|
|
1168
|
-
p:
|
|
1169
|
-
P:
|
|
1170
|
-
},
|
|
1171
|
-
function
|
|
1172
|
-
return
|
|
1162
|
+
return s.replace("{{date}}", at(r, e)).replace("{{time}}", dt(a, e));
|
|
1163
|
+
}, ce = {
|
|
1164
|
+
p: dt,
|
|
1165
|
+
P: oe
|
|
1166
|
+
}, le = /^D+$/, ue = /^Y+$/, he = ["D", "DD", "YY", "YYYY"];
|
|
1167
|
+
function de(t) {
|
|
1168
|
+
return le.test(t);
|
|
1173
1169
|
}
|
|
1174
|
-
function
|
|
1175
|
-
return
|
|
1170
|
+
function fe(t) {
|
|
1171
|
+
return ue.test(t);
|
|
1176
1172
|
}
|
|
1177
|
-
function
|
|
1178
|
-
const r =
|
|
1179
|
-
if (console.warn(r),
|
|
1173
|
+
function me(t, e, n) {
|
|
1174
|
+
const r = ge(t, e, n);
|
|
1175
|
+
if (console.warn(r), he.includes(t)) throw new RangeError(r);
|
|
1180
1176
|
}
|
|
1181
|
-
function
|
|
1177
|
+
function ge(t, e, n) {
|
|
1182
1178
|
const r = t[0] === "Y" ? "years" : "days of the month";
|
|
1183
1179
|
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`;
|
|
1184
1180
|
}
|
|
1185
|
-
const
|
|
1186
|
-
function
|
|
1187
|
-
var f,
|
|
1188
|
-
const r =
|
|
1189
|
-
if (!
|
|
1181
|
+
const ye = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g, pe = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g, we = /^'([^]*?)'?$/, be = /''/g, ke = /[a-zA-Z]/;
|
|
1182
|
+
function De(t, e, n) {
|
|
1183
|
+
var f, y, g, M;
|
|
1184
|
+
const r = L(), a = r.locale ?? re, s = r.firstWeekContainsDate ?? ((y = (f = r.locale) == null ? void 0 : f.options) == null ? void 0 : y.firstWeekContainsDate) ?? 1, i = r.weekStartsOn ?? ((M = (g = r.locale) == null ? void 0 : g.options) == null ? void 0 : M.weekStartsOn) ?? 0, o = k(t, n == null ? void 0 : n.in);
|
|
1185
|
+
if (!St(o))
|
|
1190
1186
|
throw new RangeError("Invalid time value");
|
|
1191
|
-
let
|
|
1192
|
-
const
|
|
1193
|
-
if (
|
|
1194
|
-
const
|
|
1195
|
-
return
|
|
1187
|
+
let c = e.match(pe).map((w) => {
|
|
1188
|
+
const b = w[0];
|
|
1189
|
+
if (b === "p" || b === "P") {
|
|
1190
|
+
const B = ce[b];
|
|
1191
|
+
return B(w, a.formatLong);
|
|
1196
1192
|
}
|
|
1197
|
-
return
|
|
1198
|
-
}).join("").match(
|
|
1199
|
-
if (
|
|
1193
|
+
return w;
|
|
1194
|
+
}).join("").match(ye).map((w) => {
|
|
1195
|
+
if (w === "''")
|
|
1200
1196
|
return { isToken: !1, value: "'" };
|
|
1201
|
-
const
|
|
1202
|
-
if (
|
|
1203
|
-
return { isToken: !1, value:
|
|
1204
|
-
if (
|
|
1205
|
-
return { isToken: !0, value:
|
|
1206
|
-
if (
|
|
1197
|
+
const b = w[0];
|
|
1198
|
+
if (b === "'")
|
|
1199
|
+
return { isToken: !1, value: Se(w) };
|
|
1200
|
+
if (et[b])
|
|
1201
|
+
return { isToken: !0, value: w };
|
|
1202
|
+
if (b.match(ke))
|
|
1207
1203
|
throw new RangeError(
|
|
1208
|
-
"Format string contains an unescaped latin alphabet character `" +
|
|
1204
|
+
"Format string contains an unescaped latin alphabet character `" + b + "`"
|
|
1209
1205
|
);
|
|
1210
|
-
return { isToken: !1, value:
|
|
1206
|
+
return { isToken: !1, value: w };
|
|
1211
1207
|
});
|
|
1212
|
-
a.localize.preprocessor && (
|
|
1213
|
-
const
|
|
1208
|
+
a.localize.preprocessor && (c = a.localize.preprocessor(o, c));
|
|
1209
|
+
const h = {
|
|
1214
1210
|
firstWeekContainsDate: s,
|
|
1215
1211
|
weekStartsOn: i,
|
|
1216
1212
|
locale: a
|
|
1217
1213
|
};
|
|
1218
|
-
return
|
|
1219
|
-
if (!
|
|
1220
|
-
const
|
|
1221
|
-
(
|
|
1222
|
-
const
|
|
1223
|
-
return
|
|
1214
|
+
return c.map((w) => {
|
|
1215
|
+
if (!w.isToken) return w.value;
|
|
1216
|
+
const b = w.value;
|
|
1217
|
+
(fe(b) || de(b)) && me(b, e, String(t));
|
|
1218
|
+
const B = et[b[0]];
|
|
1219
|
+
return B(o, b, a.localize, h);
|
|
1224
1220
|
}).join("");
|
|
1225
1221
|
}
|
|
1226
|
-
function
|
|
1227
|
-
const e = t.match(
|
|
1228
|
-
return e ? e[1].replace(
|
|
1222
|
+
function Se(t) {
|
|
1223
|
+
const e = t.match(we);
|
|
1224
|
+
return e ? e[1].replace(be, "'") : t;
|
|
1229
1225
|
}
|
|
1230
|
-
function
|
|
1231
|
-
const n =
|
|
1226
|
+
function ve(t, e) {
|
|
1227
|
+
const n = k(t, e == null ? void 0 : e.in).getDay();
|
|
1232
1228
|
return n === 0 ? 7 : n;
|
|
1233
1229
|
}
|
|
1234
|
-
const
|
|
1230
|
+
const X = {}, A = {};
|
|
1235
1231
|
function F(t, e) {
|
|
1236
1232
|
try {
|
|
1237
|
-
const r = (
|
|
1233
|
+
const r = (X[t] || (X[t] = new Intl.DateTimeFormat("en-GB", {
|
|
1238
1234
|
timeZone: t,
|
|
1239
1235
|
hour: "numeric",
|
|
1240
1236
|
timeZoneName: "longOffset"
|
|
1241
1237
|
}).format))(e).split("GMT")[1] || "";
|
|
1242
|
-
return r in
|
|
1238
|
+
return r in A ? A[r] : st(r, r.split(":"));
|
|
1243
1239
|
} catch {
|
|
1244
|
-
if (t in
|
|
1245
|
-
const n = t == null ? void 0 : t.match(
|
|
1246
|
-
return n ?
|
|
1240
|
+
if (t in A) return A[t];
|
|
1241
|
+
const n = t == null ? void 0 : t.match(Me);
|
|
1242
|
+
return n ? st(t, n.slice(1)) : NaN;
|
|
1247
1243
|
}
|
|
1248
1244
|
}
|
|
1249
|
-
const
|
|
1250
|
-
function
|
|
1245
|
+
const Me = /([+-]\d\d):?(\d\d)?/;
|
|
1246
|
+
function st(t, e) {
|
|
1251
1247
|
const n = +e[0], r = +(e[1] || 0);
|
|
1252
|
-
return
|
|
1248
|
+
return A[t] = n > 0 ? n * 60 + r : n * 60 - r;
|
|
1253
1249
|
}
|
|
1254
|
-
class
|
|
1250
|
+
class S extends Date {
|
|
1255
1251
|
//#region static
|
|
1256
1252
|
constructor(...e) {
|
|
1257
|
-
super(), e.length > 1 && typeof e[e.length - 1] == "string" && (this.timeZone = e.pop()), this.internal = /* @__PURE__ */ new Date(), isNaN(F(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)),
|
|
1253
|
+
super(), e.length > 1 && typeof e[e.length - 1] == "string" && (this.timeZone = e.pop()), this.internal = /* @__PURE__ */ new Date(), isNaN(F(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)), ft(this), V(this)) : this.setTime(Date.now());
|
|
1258
1254
|
}
|
|
1259
1255
|
static tz(e, ...n) {
|
|
1260
|
-
return n.length ? new
|
|
1256
|
+
return n.length ? new S(...n, e) : new S(Date.now(), e);
|
|
1261
1257
|
}
|
|
1262
1258
|
//#endregion
|
|
1263
1259
|
//#region time zone
|
|
1264
1260
|
withTimeZone(e) {
|
|
1265
|
-
return new
|
|
1261
|
+
return new S(+this, e);
|
|
1266
1262
|
}
|
|
1267
1263
|
getTimezoneOffset() {
|
|
1268
1264
|
return -F(this.timeZone, this);
|
|
@@ -1270,51 +1266,51 @@ class v extends Date {
|
|
|
1270
1266
|
//#endregion
|
|
1271
1267
|
//#region time
|
|
1272
1268
|
setTime(e) {
|
|
1273
|
-
return Date.prototype.setTime.apply(this, arguments),
|
|
1269
|
+
return Date.prototype.setTime.apply(this, arguments), V(this), +this;
|
|
1274
1270
|
}
|
|
1275
1271
|
//#endregion
|
|
1276
1272
|
//#region date-fns integration
|
|
1277
1273
|
[Symbol.for("constructDateFrom")](e) {
|
|
1278
|
-
return new
|
|
1274
|
+
return new S(+new Date(e), this.timeZone);
|
|
1279
1275
|
}
|
|
1280
1276
|
//#endregion
|
|
1281
1277
|
}
|
|
1282
|
-
const
|
|
1278
|
+
const it = /^(get|set)(?!UTC)/;
|
|
1283
1279
|
Object.getOwnPropertyNames(Date.prototype).forEach((t) => {
|
|
1284
|
-
if (!
|
|
1285
|
-
const e = t.replace(
|
|
1286
|
-
|
|
1280
|
+
if (!it.test(t)) return;
|
|
1281
|
+
const e = t.replace(it, "$1UTC");
|
|
1282
|
+
S.prototype[e] && (t.startsWith("get") ? S.prototype[t] = function() {
|
|
1287
1283
|
return this.internal[e]();
|
|
1288
|
-
} : (
|
|
1289
|
-
return Date.prototype[e].apply(this.internal, arguments),
|
|
1290
|
-
},
|
|
1291
|
-
return Date.prototype[e].apply(this, arguments),
|
|
1284
|
+
} : (S.prototype[t] = function() {
|
|
1285
|
+
return Date.prototype[e].apply(this.internal, arguments), Te(this), +this;
|
|
1286
|
+
}, S.prototype[e] = function() {
|
|
1287
|
+
return Date.prototype[e].apply(this, arguments), V(this), +this;
|
|
1292
1288
|
}));
|
|
1293
1289
|
});
|
|
1294
|
-
function
|
|
1290
|
+
function V(t) {
|
|
1295
1291
|
t.internal.setTime(+t), t.internal.setUTCMinutes(t.internal.getUTCMinutes() - t.getTimezoneOffset());
|
|
1296
1292
|
}
|
|
1297
|
-
function
|
|
1298
|
-
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()),
|
|
1293
|
+
function Te(t) {
|
|
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()), ft(t);
|
|
1299
1295
|
}
|
|
1300
|
-
function
|
|
1296
|
+
function ft(t) {
|
|
1301
1297
|
const e = F(t.timeZone, t), n = /* @__PURE__ */ new Date(+t);
|
|
1302
1298
|
n.setUTCHours(n.getUTCHours() - 1);
|
|
1303
1299
|
const r = -(/* @__PURE__ */ new Date(+t)).getTimezoneOffset(), a = -(/* @__PURE__ */ new Date(+n)).getTimezoneOffset(), s = r - a, i = Date.prototype.getHours.apply(t) !== t.internal.getUTCHours();
|
|
1304
1300
|
s && i && t.internal.setUTCMinutes(t.internal.getUTCMinutes() + s);
|
|
1305
|
-
const
|
|
1306
|
-
|
|
1307
|
-
const
|
|
1308
|
-
if (
|
|
1309
|
-
Date.prototype.setUTCMinutes.call(t, Date.prototype.getUTCMinutes.call(t) +
|
|
1310
|
-
const
|
|
1311
|
-
|
|
1301
|
+
const o = r - e;
|
|
1302
|
+
o && Date.prototype.setUTCMinutes.call(t, Date.prototype.getUTCMinutes.call(t) + o);
|
|
1303
|
+
const c = F(t.timeZone, t), f = -(/* @__PURE__ */ new Date(+t)).getTimezoneOffset() - c, y = c !== e, g = f - o;
|
|
1304
|
+
if (y && g) {
|
|
1305
|
+
Date.prototype.setUTCMinutes.call(t, Date.prototype.getUTCMinutes.call(t) + g);
|
|
1306
|
+
const M = F(t.timeZone, t), w = c - M;
|
|
1307
|
+
w && (t.internal.setUTCMinutes(t.internal.getUTCMinutes() + w), Date.prototype.setUTCMinutes.call(t, Date.prototype.getUTCMinutes.call(t) + w));
|
|
1312
1308
|
}
|
|
1313
1309
|
}
|
|
1314
|
-
class
|
|
1310
|
+
class O extends S {
|
|
1315
1311
|
//#region static
|
|
1316
1312
|
static tz(e, ...n) {
|
|
1317
|
-
return n.length ? new
|
|
1313
|
+
return n.length ? new O(...n, e) : new O(Date.now(), e);
|
|
1318
1314
|
}
|
|
1319
1315
|
//#endregion
|
|
1320
1316
|
//#region representation
|
|
@@ -1331,7 +1327,7 @@ class _ extends v {
|
|
|
1331
1327
|
}
|
|
1332
1328
|
toTimeString() {
|
|
1333
1329
|
const e = this.internal.toUTCString().split(" ")[4], [n, r, a] = this.tzComponents();
|
|
1334
|
-
return `${e} GMT${n}${r}${a} (${
|
|
1330
|
+
return `${e} GMT${n}${r}${a} (${xe(this.timeZone, this)})`;
|
|
1335
1331
|
}
|
|
1336
1332
|
toLocaleString(e, n) {
|
|
1337
1333
|
return Date.prototype.toLocaleString.call(this, e, {
|
|
@@ -1359,26 +1355,26 @@ class _ extends v {
|
|
|
1359
1355
|
}
|
|
1360
1356
|
//#endregion
|
|
1361
1357
|
withTimeZone(e) {
|
|
1362
|
-
return new
|
|
1358
|
+
return new O(+this, e);
|
|
1363
1359
|
}
|
|
1364
1360
|
//#region date-fns integration
|
|
1365
1361
|
[Symbol.for("constructDateFrom")](e) {
|
|
1366
|
-
return new
|
|
1362
|
+
return new O(+new Date(e), this.timeZone);
|
|
1367
1363
|
}
|
|
1368
1364
|
//#endregion
|
|
1369
1365
|
}
|
|
1370
|
-
function
|
|
1366
|
+
function xe(t, e) {
|
|
1371
1367
|
return new Intl.DateTimeFormat("en-GB", {
|
|
1372
1368
|
timeZone: t,
|
|
1373
1369
|
timeZoneName: "long"
|
|
1374
1370
|
}).format(e).slice(12);
|
|
1375
1371
|
}
|
|
1376
1372
|
window.pktTz = window.pktTz === void 0 ? "Europe/Oslo" : window.pktTz;
|
|
1377
|
-
const
|
|
1378
|
-
const e = new
|
|
1373
|
+
const Oe = (t = window.pktTz) => {
|
|
1374
|
+
const e = new O((/* @__PURE__ */ new Date()).toISOString(), t);
|
|
1379
1375
|
return e.setHours(0, 0, 0, 0), isNaN(e.getTime()) ? /* @__PURE__ */ new Date() : new Date(e.getFullYear(), e.getMonth(), e.getDate());
|
|
1380
1376
|
};
|
|
1381
|
-
function
|
|
1377
|
+
function $(t) {
|
|
1382
1378
|
if (!t || t === "") return /* @__PURE__ */ new Date();
|
|
1383
1379
|
if (/^\d{4}-\d{2}-\d{2}$/.test(t)) {
|
|
1384
1380
|
const [e, n, r] = t.split("-").map(Number);
|
|
@@ -1390,39 +1386,63 @@ function N(t) {
|
|
|
1390
1386
|
}
|
|
1391
1387
|
return /^\d{4}$/.test(t) ? new Date(Number(t), 0, 1) : new Date(t);
|
|
1392
1388
|
}
|
|
1393
|
-
const
|
|
1389
|
+
const p = (t) => {
|
|
1394
1390
|
if (!t || isNaN(t.getTime())) return "";
|
|
1395
1391
|
const e = t.getFullYear(), n = String(t.getMonth() + 1).padStart(2, "0"), r = String(t.getDate()).padStart(2, "0");
|
|
1396
1392
|
return `${e}-${n}-${r}`;
|
|
1397
|
-
},
|
|
1393
|
+
}, I = (t) => {
|
|
1398
1394
|
if (!t)
|
|
1399
1395
|
return null;
|
|
1400
|
-
const e =
|
|
1396
|
+
const e = $(t);
|
|
1401
1397
|
return isNaN(e.getTime()) ? null : e;
|
|
1402
|
-
},
|
|
1403
|
-
const n =
|
|
1404
|
-
return isNaN(n.getTime()) ? "" :
|
|
1405
|
-
},
|
|
1406
|
-
const n = typeof t == "string" ?
|
|
1407
|
-
return !n || isNaN(n.getTime()) ? /* @__PURE__ */ new Date() :
|
|
1408
|
-
},
|
|
1398
|
+
}, Le = (t, e) => {
|
|
1399
|
+
const n = _(t);
|
|
1400
|
+
return isNaN(n.getTime()) ? "" : De(n, e);
|
|
1401
|
+
}, _ = (t = "", e) => {
|
|
1402
|
+
const n = typeof t == "string" ? $(t) : t;
|
|
1403
|
+
return !n || isNaN(n.getTime()) ? /* @__PURE__ */ new Date() : n;
|
|
1404
|
+
}, x = (t, e, n = 1) => {
|
|
1409
1405
|
if (typeof t != "number" || typeof e != "number" || typeof n != "number" || isNaN(t) || isNaN(e) || isNaN(n))
|
|
1410
1406
|
return /* @__PURE__ */ new Date();
|
|
1411
1407
|
const r = new Date(t, e, n);
|
|
1412
1408
|
return isNaN(r.getTime()) ? /* @__PURE__ */ new Date() : r;
|
|
1413
|
-
},
|
|
1409
|
+
}, Y = (t) => {
|
|
1410
|
+
let e;
|
|
1411
|
+
return typeof t == "number" ? e = new O(t, window.pktTz) : e = new O(t, window.pktTz), e.setHours(12, 0, 0, 0), e;
|
|
1412
|
+
}, Pe = (t) => !t || isNaN(t.getTime()) ? "" : new Intl.DateTimeFormat("no", { dateStyle: "full", timeZone: window.pktTz }).format(t), Ne = (t, e, n) => {
|
|
1413
|
+
if (!t || isNaN(t.getTime())) return !1;
|
|
1414
|
+
const r = e ? _(e) : null, a = n ? _(n) : null;
|
|
1415
|
+
return !(r && t < r || a && t > a);
|
|
1416
|
+
}, $e = (t, e) => {
|
|
1417
|
+
if (!t || isNaN(t.getTime()) || !Array.isArray(e)) return !1;
|
|
1418
|
+
const n = p(t);
|
|
1419
|
+
return e.includes(n);
|
|
1420
|
+
}, Ce = (t, e) => {
|
|
1421
|
+
if (!t || isNaN(t.getTime()) || !Array.isArray(e)) return !1;
|
|
1422
|
+
const n = t.getDay().toString();
|
|
1423
|
+
return e.includes(n);
|
|
1424
|
+
}, mt = (t, e, n, r, a) => !(!t || isNaN(t.getTime()) || !Ne(t, e, n) || r && $e(t, r) || a && Ce(t, a)), Ue = (t, e, n, r, a) => t.filter((s) => {
|
|
1425
|
+
const i = I(s);
|
|
1426
|
+
return i && mt(i, e, n, r, a);
|
|
1427
|
+
}), Be = (t) => t.slice().sort((e, n) => {
|
|
1428
|
+
const r = I(e), a = I(n);
|
|
1429
|
+
return !r || !a ? 0 : r.getTime() - a.getTime();
|
|
1430
|
+
}), ze = (t, e) => {
|
|
1431
|
+
const n = I(t), r = I(e);
|
|
1432
|
+
return !n || !r ? !1 : n <= r;
|
|
1433
|
+
}, _e = (t) => {
|
|
1414
1434
|
if (Array.isArray(t)) return t;
|
|
1415
1435
|
if (typeof t == "string") return t.split(",");
|
|
1416
|
-
},
|
|
1436
|
+
}, Ee = (t) => t ? $(t) : null, We = (t) => {
|
|
1417
1437
|
if (typeof t == "string")
|
|
1418
|
-
return t.split(",").map((e) =>
|
|
1438
|
+
return t.split(",").map((e) => $(e));
|
|
1419
1439
|
if (Array.isArray(t))
|
|
1420
|
-
return t.map((e) =>
|
|
1421
|
-
},
|
|
1422
|
-
csvToArray:
|
|
1423
|
-
stringToDate:
|
|
1424
|
-
stringsToDate:
|
|
1425
|
-
},
|
|
1440
|
+
return t.map((e) => $(e));
|
|
1441
|
+
}, U = {
|
|
1442
|
+
csvToArray: _e,
|
|
1443
|
+
stringToDate: Ee,
|
|
1444
|
+
stringsToDate: We
|
|
1445
|
+
}, Ye = {
|
|
1426
1446
|
earliest: {
|
|
1427
1447
|
default: null
|
|
1428
1448
|
},
|
|
@@ -1445,14 +1465,14 @@ const y = (t) => {
|
|
|
1445
1465
|
default: !1
|
|
1446
1466
|
}
|
|
1447
1467
|
}, P = {
|
|
1448
|
-
props:
|
|
1468
|
+
props: Ye
|
|
1449
1469
|
};
|
|
1450
|
-
var
|
|
1451
|
-
for (var a = r > 1 ? void 0 : r ?
|
|
1470
|
+
var Ae = Object.defineProperty, Fe = Object.getOwnPropertyDescriptor, d = (t, e, n, r) => {
|
|
1471
|
+
for (var a = r > 1 ? void 0 : r ? Fe(e, n) : e, s = t.length - 1, i; s >= 0; s--)
|
|
1452
1472
|
(i = t[s]) && (a = (r ? i(e, n, a) : i(a)) || a);
|
|
1453
|
-
return r && a &&
|
|
1473
|
+
return r && a && Ae(e, n, a), a;
|
|
1454
1474
|
};
|
|
1455
|
-
let
|
|
1475
|
+
let u = class extends gt {
|
|
1456
1476
|
constructor() {
|
|
1457
1477
|
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;
|
|
1458
1478
|
}
|
|
@@ -1475,8 +1495,8 @@ let h = class extends dt {
|
|
|
1475
1495
|
this.addEventListener("keydown", this.handleKeydown);
|
|
1476
1496
|
}
|
|
1477
1497
|
convertSelected() {
|
|
1478
|
-
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) =>
|
|
1479
|
-
const t =
|
|
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) => $(t)), this.range && this.selected.length === 2) {
|
|
1499
|
+
const t = Q({
|
|
1480
1500
|
start: this._selected[0],
|
|
1481
1501
|
end: this._selected[1]
|
|
1482
1502
|
});
|
|
@@ -1484,7 +1504,7 @@ let h = class extends dt {
|
|
|
1484
1504
|
const e = {};
|
|
1485
1505
|
for (let n = 0; n < t.length; n++) {
|
|
1486
1506
|
const r = t[n], a = r > this._selected[0] && r < this._selected[1];
|
|
1487
|
-
e[
|
|
1507
|
+
e[p(r)] = a;
|
|
1488
1508
|
}
|
|
1489
1509
|
this.inRange = e;
|
|
1490
1510
|
}
|
|
@@ -1493,10 +1513,10 @@ let h = class extends dt {
|
|
|
1493
1513
|
}
|
|
1494
1514
|
setCurrentMonth() {
|
|
1495
1515
|
if (this.currentmonth === null && !this.currentmonthtouched && (this.currentmonthtouched = !0), this.selected.length && this.selected[0] !== "") {
|
|
1496
|
-
const t =
|
|
1497
|
-
this.currentmonth = isNaN(t.getTime()) ? /* @__PURE__ */ new Date() : t;
|
|
1498
|
-
} else this.currentmonth === null && (this.currentmonth = /* @__PURE__ */ new Date());
|
|
1499
|
-
(!this.currentmonth || isNaN(this.currentmonth.getTime())) && (this.currentmonth = /* @__PURE__ */ new Date()), this.year = this.currentmonth.getFullYear(), this.month = this.currentmonth.getMonth();
|
|
1516
|
+
const t = $(this.selected[this.selected.length - 1]);
|
|
1517
|
+
this.currentmonth = isNaN(t.getTime()) ? Y(/* @__PURE__ */ new Date()) : t;
|
|
1518
|
+
} else this.currentmonth === null && (this.currentmonth = Y(/* @__PURE__ */ new Date()));
|
|
1519
|
+
(!this.currentmonth || isNaN(this.currentmonth.getTime())) && (this.currentmonth = Y(/* @__PURE__ */ new Date())), this.year = this.currentmonth.getFullYear(), this.month = this.currentmonth.getMonth();
|
|
1500
1520
|
}
|
|
1501
1521
|
handleKeydown(t) {
|
|
1502
1522
|
switch (t.key) {
|
|
@@ -1515,23 +1535,23 @@ let h = class extends dt {
|
|
|
1515
1535
|
}
|
|
1516
1536
|
}
|
|
1517
1537
|
handleArrowKey(t, e) {
|
|
1518
|
-
var a, s, i,
|
|
1519
|
-
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" && !((
|
|
1538
|
+
var a, s, i, o, c;
|
|
1539
|
+
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))
|
|
1520
1540
|
return;
|
|
1521
1541
|
t.preventDefault(), this.focusedDate || this.focusOnCurrentDate();
|
|
1522
|
-
const n = this.focusedDate ?
|
|
1523
|
-
let r =
|
|
1542
|
+
const n = this.focusedDate ? _(this.focusedDate) : x(this.year, this.month, 1);
|
|
1543
|
+
let r = j(n, e);
|
|
1524
1544
|
if (r) {
|
|
1525
|
-
let
|
|
1526
|
-
if (
|
|
1527
|
-
if (
|
|
1528
|
-
r =
|
|
1529
|
-
let f = this.querySelector(`button[data-date="${
|
|
1545
|
+
let h = this.querySelector(`button[data-date="${p(r)}"]`);
|
|
1546
|
+
if (h instanceof HTMLButtonElement) {
|
|
1547
|
+
if (h.dataset.disabled) {
|
|
1548
|
+
r = j(r, e);
|
|
1549
|
+
let f = this.querySelector(`button[data-date="${p(r)}"]`);
|
|
1530
1550
|
for (; f && f instanceof HTMLButtonElement && f.dataset.disabled; )
|
|
1531
|
-
r =
|
|
1532
|
-
|
|
1551
|
+
r = j(r, e), f = this.querySelector(`button[data-date="${p(r)}"]`);
|
|
1552
|
+
h = f;
|
|
1533
1553
|
}
|
|
1534
|
-
|
|
1554
|
+
h instanceof HTMLButtonElement && !h.dataset.disabled && (this.focusedDate = p(r), h.focus());
|
|
1535
1555
|
}
|
|
1536
1556
|
}
|
|
1537
1557
|
}
|
|
@@ -1539,7 +1559,7 @@ let h = class extends dt {
|
|
|
1539
1559
|
* Component functionality and render
|
|
1540
1560
|
*/
|
|
1541
1561
|
render() {
|
|
1542
|
-
return
|
|
1562
|
+
return D`
|
|
1543
1563
|
<div
|
|
1544
1564
|
class="pkt-calendar ${this.weeknumbers ? "pkt-cal-weeknumbers" : ""}"
|
|
1545
1565
|
@focusout=${this.closeEvent}
|
|
@@ -1557,7 +1577,7 @@ let h = class extends dt {
|
|
|
1557
1577
|
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), this.isPrevMonthAllowed() && this.prevMonth());
|
|
1558
1578
|
}}
|
|
1559
1579
|
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only pkt-calendar__prev-month ${this.isPrevMonthAllowed() ? "" : "pkt-hide"}"
|
|
1560
|
-
.data-disabled=${this.isPrevMonthAllowed() ?
|
|
1580
|
+
.data-disabled=${this.isPrevMonthAllowed() ? z : "disabled"}
|
|
1561
1581
|
?aria-disabled=${!this.isPrevMonthAllowed()}
|
|
1562
1582
|
tabindex=${this.isPrevMonthAllowed() ? "0" : "-1"}
|
|
1563
1583
|
>
|
|
@@ -1575,7 +1595,7 @@ let h = class extends dt {
|
|
|
1575
1595
|
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), this.isNextMonthAllowed() && this.nextMonth());
|
|
1576
1596
|
}}
|
|
1577
1597
|
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only pkt-calendar__next-month ${this.isNextMonthAllowed() ? "" : "pkt-hide"}"
|
|
1578
|
-
.data-disabled=${this.isNextMonthAllowed() ?
|
|
1598
|
+
.data-disabled=${this.isNextMonthAllowed() ? z : "disabled"}
|
|
1579
1599
|
?aria-disabled=${!this.isNextMonthAllowed()}
|
|
1580
1600
|
tabindex=${this.isNextMonthAllowed() ? "0" : "-1"}
|
|
1581
1601
|
>
|
|
@@ -1601,23 +1621,23 @@ let h = class extends dt {
|
|
|
1601
1621
|
}
|
|
1602
1622
|
renderDayNames() {
|
|
1603
1623
|
const t = [];
|
|
1604
|
-
this.weeknumbers && t.push(
|
|
1624
|
+
this.weeknumbers && t.push(D`<th><div class="pkt-calendar__week-number">${this.weekString}</div></th>`);
|
|
1605
1625
|
for (let e = 0; e < this.dayStrings.length; e++)
|
|
1606
1626
|
t.push(
|
|
1607
|
-
|
|
1627
|
+
D`<th>
|
|
1608
1628
|
<div class="pkt-calendar__day-name" aria-label="${this.dayStringsLong[e]}">
|
|
1609
1629
|
${this.dayStrings[e]}
|
|
1610
1630
|
</div>
|
|
1611
1631
|
</th>`
|
|
1612
1632
|
);
|
|
1613
|
-
return
|
|
1633
|
+
return D`<tr class="pkt-cal-week-row">
|
|
1614
1634
|
${t}
|
|
1615
1635
|
</tr>`;
|
|
1616
1636
|
}
|
|
1617
1637
|
renderMonthNav() {
|
|
1618
1638
|
let t = [];
|
|
1619
1639
|
return this.withcontrols ? t.push(
|
|
1620
|
-
|
|
1640
|
+
D`<div class="pkt-cal-month-picker">
|
|
1621
1641
|
<label for="${this.id}-monthnav" class="pkt-hide">${this.strings.dates.month}</label>
|
|
1622
1642
|
<select
|
|
1623
1643
|
aria-label="${this.strings.dates.month}"
|
|
@@ -1628,7 +1648,7 @@ let h = class extends dt {
|
|
|
1628
1648
|
}}
|
|
1629
1649
|
>
|
|
1630
1650
|
${this.monthStrings.map(
|
|
1631
|
-
(e, n) =>
|
|
1651
|
+
(e, n) => D`<option value=${n} ?selected=${this.month === n}>${e}</option>`
|
|
1632
1652
|
)}
|
|
1633
1653
|
</select>
|
|
1634
1654
|
<label for="${this.id}-yearnav" class="pkt-hide">${this.strings.dates.year}</label>
|
|
@@ -1646,54 +1666,54 @@ let h = class extends dt {
|
|
|
1646
1666
|
/>
|
|
1647
1667
|
</div> `
|
|
1648
1668
|
) : t.push(
|
|
1649
|
-
|
|
1669
|
+
D`<div class="pkt-txt-16-medium pkt-calendar__month-title" aria-live="polite">
|
|
1650
1670
|
${this.monthStrings[this.month]} ${this.year}
|
|
1651
1671
|
</div>`
|
|
1652
1672
|
), t;
|
|
1653
1673
|
}
|
|
1654
|
-
renderDayView(t, e
|
|
1655
|
-
var
|
|
1656
|
-
const
|
|
1657
|
-
|
|
1658
|
-
const
|
|
1659
|
-
"pkt-cal-today":
|
|
1660
|
-
"pkt-cal-selected":
|
|
1661
|
-
"pkt-cal-in-range": this.inRange[
|
|
1662
|
-
"pkt-cal-excluded": this.isExcluded(n
|
|
1663
|
-
"pkt-cal-in-range-first": this.range && (this.selected.length === 2 || this.rangeHovered !== null) &&
|
|
1664
|
-
"pkt-cal-in-range-last": this.range && this.selected.length === 2 &&
|
|
1665
|
-
"pkt-cal-range-hover": this.rangeHovered !== null &&
|
|
1666
|
-
},
|
|
1674
|
+
renderDayView(t, e) {
|
|
1675
|
+
var y;
|
|
1676
|
+
const n = x(this.year, this.month, t), r = p(n), a = r === p(e), s = this.selected.includes(r), i = Pe(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
|
+
c === "0" && (this.tabIndexSet = t), this.selectableDates.push({ currentDateISO: r, isDisabled: o, tabindex: c });
|
|
1678
|
+
const h = {
|
|
1679
|
+
"pkt-cal-today": a,
|
|
1680
|
+
"pkt-cal-selected": s,
|
|
1681
|
+
"pkt-cal-in-range": this.inRange[r],
|
|
1682
|
+
"pkt-cal-excluded": this.isExcluded(n),
|
|
1683
|
+
"pkt-cal-in-range-first": this.range && (this.selected.length === 2 || this.rangeHovered !== null) && r === this.selected[0],
|
|
1684
|
+
"pkt-cal-in-range-last": this.range && this.selected.length === 2 && r === this.selected[1],
|
|
1685
|
+
"pkt-cal-range-hover": this.rangeHovered !== null && r === p(this.rangeHovered)
|
|
1686
|
+
}, f = {
|
|
1667
1687
|
"pkt-calendar__date": !0,
|
|
1668
|
-
"pkt-calendar__date--today":
|
|
1669
|
-
"pkt-calendar__date--selected":
|
|
1688
|
+
"pkt-calendar__date--today": a,
|
|
1689
|
+
"pkt-calendar__date--selected": s,
|
|
1670
1690
|
"pkt-calendar__date--disabled": o,
|
|
1671
|
-
"pkt-calendar__date--in-range": this.inRange[
|
|
1672
|
-
"pkt-calendar__date--in-range-hover": this.rangeHovered !== null &&
|
|
1673
|
-
"pkt-calendar__date--range-start": this.range && (this.selected.length === 2 || this.rangeHovered !== null) &&
|
|
1674
|
-
"pkt-calendar__date--range-end": this.range && this.selected.length === 2 &&
|
|
1691
|
+
"pkt-calendar__date--in-range": this.inRange[r],
|
|
1692
|
+
"pkt-calendar__date--in-range-hover": this.rangeHovered !== null && r === p(this.rangeHovered),
|
|
1693
|
+
"pkt-calendar__date--range-start": this.range && (this.selected.length === 2 || this.rangeHovered !== null) && r === this.selected[0],
|
|
1694
|
+
"pkt-calendar__date--range-end": this.range && this.selected.length === 2 && r === this.selected[1]
|
|
1675
1695
|
};
|
|
1676
|
-
return
|
|
1696
|
+
return D`<td class=${J(h)}>
|
|
1677
1697
|
<button
|
|
1678
1698
|
type="button"
|
|
1679
|
-
aria-pressed=${
|
|
1699
|
+
aria-pressed=${s ? "true" : "false"}
|
|
1680
1700
|
?disabled=${o}
|
|
1681
|
-
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only ${
|
|
1682
|
-
|
|
1701
|
+
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only ${J(
|
|
1702
|
+
f
|
|
1683
1703
|
)}"
|
|
1684
|
-
@mouseover=${() => this.range && !this.isExcluded(n
|
|
1704
|
+
@mouseover=${() => this.range && !this.isExcluded(n) && this.handleRangeHover(n)}
|
|
1685
1705
|
@focus=${() => {
|
|
1686
|
-
this.range && !this.isExcluded(n
|
|
1706
|
+
this.range && !this.isExcluded(n) && this.handleRangeHover(n), this.focusedDate = r;
|
|
1687
1707
|
}}
|
|
1688
|
-
aria-label="${
|
|
1689
|
-
tabindex=${(
|
|
1690
|
-
data-disabled=${o ? "disabled" :
|
|
1691
|
-
data-date=${
|
|
1692
|
-
@keydown=${(
|
|
1693
|
-
(
|
|
1708
|
+
aria-label="${i}"
|
|
1709
|
+
tabindex=${(y = this.selectableDates.find((g) => g.currentDateISO === r)) == null ? void 0 : y.tabindex}
|
|
1710
|
+
data-disabled=${o ? "disabled" : z}
|
|
1711
|
+
data-date=${r}
|
|
1712
|
+
@keydown=${(g) => {
|
|
1713
|
+
(g.key === "Enter" || g.key === " ") && (g.preventDefault(), this.handleDateSelect(n));
|
|
1694
1714
|
}}
|
|
1695
|
-
@click=${(
|
|
1696
|
-
o || (
|
|
1715
|
+
@click=${(g) => {
|
|
1716
|
+
o || (g.preventDefault(), this.handleDateSelect(n));
|
|
1697
1717
|
}}
|
|
1698
1718
|
>
|
|
1699
1719
|
<span class="pkt-btn__text pkt-txt-14-light">${t}</span>
|
|
@@ -1701,74 +1721,83 @@ let h = class extends dt {
|
|
|
1701
1721
|
</td>`;
|
|
1702
1722
|
}
|
|
1703
1723
|
renderCalendarBody() {
|
|
1704
|
-
const t =
|
|
1705
|
-
let
|
|
1706
|
-
this.week =
|
|
1707
|
-
const
|
|
1724
|
+
const t = Oe(), 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
|
+
let c = 1;
|
|
1726
|
+
this.week = ht(x(this.year, this.month, 1));
|
|
1727
|
+
const h = [];
|
|
1708
1728
|
for (let f = 0; f < s; f++) {
|
|
1709
|
-
const
|
|
1710
|
-
this.weeknumbers &&
|
|
1711
|
-
for (let
|
|
1712
|
-
if (f === 0 &&
|
|
1713
|
-
const
|
|
1714
|
-
|
|
1715
|
-
|
|
1729
|
+
const y = [];
|
|
1730
|
+
this.weeknumbers && y.push(D`<td class="pkt-cal-week">${this.week}</td>`), this.week++;
|
|
1731
|
+
for (let g = 1; g < 8; g++)
|
|
1732
|
+
if (f === 0 && g < r + 1) {
|
|
1733
|
+
const M = o - (r - g);
|
|
1734
|
+
y.push(
|
|
1735
|
+
D`<td class="pkt-cal-other">
|
|
1716
1736
|
<div
|
|
1717
1737
|
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only"
|
|
1718
1738
|
data-disabled="disabled"
|
|
1719
1739
|
>
|
|
1720
|
-
<span class="pkt-btn__text pkt-txt-14-light">${
|
|
1740
|
+
<span class="pkt-btn__text pkt-txt-14-light">${M}</span>
|
|
1721
1741
|
</div>
|
|
1722
1742
|
</td>`
|
|
1723
1743
|
);
|
|
1724
|
-
} else
|
|
1725
|
-
|
|
1744
|
+
} else c > a ? (y.push(
|
|
1745
|
+
D`<td class="pkt-cal-other">
|
|
1726
1746
|
<div
|
|
1727
1747
|
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only"
|
|
1728
1748
|
data-disabled="disabled"
|
|
1729
1749
|
>
|
|
1730
|
-
<span class="pkt-btn__text pkt-txt-14-light">${
|
|
1750
|
+
<span class="pkt-btn__text pkt-txt-14-light">${c - a}</span>
|
|
1731
1751
|
</div>
|
|
1732
1752
|
</td>`
|
|
1733
|
-
),
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
${
|
|
1753
|
+
), c++) : (y.push(this.renderDayView(c, t)), c++);
|
|
1754
|
+
h.push(
|
|
1755
|
+
D`<tr class="pkt-cal-week-row" role="row">
|
|
1756
|
+
${y}
|
|
1737
1757
|
</tr>`
|
|
1738
1758
|
);
|
|
1739
1759
|
}
|
|
1740
|
-
return
|
|
1760
|
+
return h;
|
|
1741
1761
|
}
|
|
1742
|
-
isExcluded(t
|
|
1743
|
-
|
|
1762
|
+
isExcluded(t) {
|
|
1763
|
+
const e = this.excludedates.map(
|
|
1764
|
+
(n) => typeof n == "string" ? n : p(n)
|
|
1765
|
+
);
|
|
1766
|
+
return !mt(
|
|
1767
|
+
t,
|
|
1768
|
+
this.earliest,
|
|
1769
|
+
this.latest,
|
|
1770
|
+
e,
|
|
1771
|
+
this.excludeweekdays
|
|
1772
|
+
);
|
|
1744
1773
|
}
|
|
1745
1774
|
isPrevMonthAllowed() {
|
|
1746
|
-
const t =
|
|
1747
|
-
return !(this.earliest &&
|
|
1775
|
+
const t = x(this.year, this.month, 0);
|
|
1776
|
+
return !(this.earliest && _(this.earliest) > t);
|
|
1748
1777
|
}
|
|
1749
1778
|
prevMonth() {
|
|
1750
1779
|
const t = this.month === 0 ? 11 : this.month - 1, e = this.month === 0 ? this.year - 1 : this.year;
|
|
1751
1780
|
this.changeMonth(e, t);
|
|
1752
1781
|
}
|
|
1753
1782
|
isNextMonthAllowed() {
|
|
1754
|
-
const t =
|
|
1783
|
+
const t = x(
|
|
1755
1784
|
this.month === 11 ? this.year + 1 : this.year,
|
|
1756
1785
|
this.month === 11 ? 0 : this.month + 1,
|
|
1757
1786
|
1
|
|
1758
1787
|
);
|
|
1759
|
-
return !(this.latest &&
|
|
1788
|
+
return !(this.latest && _(this.latest) < t);
|
|
1760
1789
|
}
|
|
1761
1790
|
nextMonth() {
|
|
1762
1791
|
const t = this.month === 11 ? 0 : this.month + 1, e = this.month === 11 ? this.year + 1 : this.year;
|
|
1763
1792
|
this.changeMonth(e, t);
|
|
1764
1793
|
}
|
|
1765
1794
|
changeMonth(t, e) {
|
|
1766
|
-
this.year = typeof t == "string" ? parseInt(t) : t, this.month = typeof e == "string" ? parseInt(e) : e, this.currentmonth = new Date(this.year, this.month, 1), this.tabIndexSet = 0, this.focusedDate = null, this.selectableDates = [];
|
|
1795
|
+
this.year = typeof t == "string" ? parseInt(t) : t, this.month = typeof e == "string" ? parseInt(e) : e, this.currentmonth = Y(new Date(this.year, this.month, 1)), this.tabIndexSet = 0, this.focusedDate = null, this.selectableDates = [];
|
|
1767
1796
|
}
|
|
1768
1797
|
isRangeAllowed(t) {
|
|
1769
1798
|
let e = !0;
|
|
1770
1799
|
if (this._selected.length === 1) {
|
|
1771
|
-
const n =
|
|
1800
|
+
const n = Q({
|
|
1772
1801
|
start: this._selected[0],
|
|
1773
1802
|
end: t
|
|
1774
1803
|
});
|
|
@@ -1776,7 +1805,7 @@ let h = class extends dt {
|
|
|
1776
1805
|
for (let r = 0; r < n.length; r++)
|
|
1777
1806
|
this.excludedates.forEach((a) => {
|
|
1778
1807
|
a > this._selected[0] && a < t && (e = !1);
|
|
1779
|
-
}), this.excludeweekdays.includes(
|
|
1808
|
+
}), this.excludeweekdays.includes(ve(n[r]).toString()) && (e = !1);
|
|
1780
1809
|
}
|
|
1781
1810
|
return e;
|
|
1782
1811
|
}
|
|
@@ -1784,42 +1813,42 @@ let h = class extends dt {
|
|
|
1784
1813
|
this.selected = [], this._selected = [], this.inRange = {};
|
|
1785
1814
|
}
|
|
1786
1815
|
addToSelected(t) {
|
|
1787
|
-
this.selected.includes(
|
|
1816
|
+
this.selected.includes(p(t)) || (this.selected = [...this.selected, p(t)], this._selected = [...this._selected, t], this.range && this.selected.length === 2 && (this.convertSelected(), this.close()));
|
|
1788
1817
|
}
|
|
1789
1818
|
removeFromSelected(t) {
|
|
1790
1819
|
if (this.selected.length === 1)
|
|
1791
1820
|
this.emptySelected();
|
|
1792
1821
|
else {
|
|
1793
|
-
const e = this.selected.indexOf(
|
|
1822
|
+
const e = this.selected.indexOf(p(t)), n = [...this.selected], r = [...this._selected];
|
|
1794
1823
|
n.splice(e, 1), r.splice(e, 1), this.selected = n, this._selected = r;
|
|
1795
1824
|
}
|
|
1796
1825
|
}
|
|
1797
1826
|
toggleSelected(t) {
|
|
1798
|
-
const e =
|
|
1827
|
+
const e = p(t);
|
|
1799
1828
|
this.selected.includes(e) ? this.removeFromSelected(t) : this.maxMultiple && this.selected.length >= this.maxMultiple || this.addToSelected(t);
|
|
1800
1829
|
}
|
|
1801
1830
|
handleRangeSelect(t) {
|
|
1802
|
-
const e =
|
|
1831
|
+
const e = p(t);
|
|
1803
1832
|
return this.selected.includes(e) ? this.selected.indexOf(e) === 0 ? this.emptySelected() : this.removeFromSelected(t) : this.selected.length > 1 ? (this.emptySelected(), this.addToSelected(t)) : (this.selected.length === 1 && !this.isRangeAllowed(t) && this.emptySelected(), this.selected.length === 1 && this._selected[0] > t && this.emptySelected(), this.addToSelected(t)), Promise.resolve();
|
|
1804
1833
|
}
|
|
1805
1834
|
handleRangeHover(t) {
|
|
1806
1835
|
if (this.range && this._selected.length === 1 && this.isRangeAllowed(t) && this._selected[0] < t) {
|
|
1807
1836
|
this.rangeHovered = t, this.inRange = {};
|
|
1808
|
-
const e =
|
|
1837
|
+
const e = Q({
|
|
1809
1838
|
start: this._selected[0],
|
|
1810
1839
|
end: t
|
|
1811
1840
|
});
|
|
1812
1841
|
if (Array.isArray(e) && e.length)
|
|
1813
1842
|
for (let n = 0; n < e.length; n++) {
|
|
1814
1843
|
const r = e[n], a = r > this._selected[0] && r < t;
|
|
1815
|
-
this.inRange[
|
|
1844
|
+
this.inRange[p(r)] = a;
|
|
1816
1845
|
}
|
|
1817
1846
|
} else
|
|
1818
1847
|
this.rangeHovered = null;
|
|
1819
1848
|
}
|
|
1820
1849
|
handleDateSelect(t) {
|
|
1821
1850
|
if (t)
|
|
1822
|
-
return this.range ? this.handleRangeSelect(t) : this.multiple ? this.toggleSelected(t) : (this.selected.includes(
|
|
1851
|
+
return this.range ? this.handleRangeSelect(t) : this.multiple ? this.toggleSelected(t) : (this.selected.includes(p(t)) ? this.emptySelected() : (this.emptySelected(), this.addToSelected(t)), this.close()), this.dispatchEvent(
|
|
1823
1852
|
new CustomEvent("date-selected", {
|
|
1824
1853
|
detail: this.selected,
|
|
1825
1854
|
bubbles: !0,
|
|
@@ -1828,7 +1857,7 @@ let h = class extends dt {
|
|
|
1828
1857
|
), Promise.resolve();
|
|
1829
1858
|
}
|
|
1830
1859
|
focusOnCurrentDate() {
|
|
1831
|
-
const t =
|
|
1860
|
+
const t = p(Y(/* @__PURE__ */ new Date())), e = this.querySelector(`button[data-date="${t}"]`);
|
|
1832
1861
|
if (e instanceof HTMLButtonElement)
|
|
1833
1862
|
this.focusedDate = t, e.focus();
|
|
1834
1863
|
else {
|
|
@@ -1856,95 +1885,98 @@ let h = class extends dt {
|
|
|
1856
1885
|
};
|
|
1857
1886
|
d([
|
|
1858
1887
|
m({ type: Boolean })
|
|
1859
|
-
],
|
|
1888
|
+
], u.prototype, "multiple", 2);
|
|
1860
1889
|
d([
|
|
1861
1890
|
m({ type: Number })
|
|
1862
|
-
],
|
|
1891
|
+
], u.prototype, "maxMultiple", 2);
|
|
1863
1892
|
d([
|
|
1864
1893
|
m({ type: Boolean })
|
|
1865
|
-
],
|
|
1894
|
+
], u.prototype, "range", 2);
|
|
1866
1895
|
d([
|
|
1867
1896
|
m({ type: Boolean })
|
|
1868
|
-
],
|
|
1897
|
+
], u.prototype, "weeknumbers", 2);
|
|
1869
1898
|
d([
|
|
1870
1899
|
m({ type: Boolean })
|
|
1871
|
-
],
|
|
1900
|
+
], u.prototype, "withcontrols", 2);
|
|
1872
1901
|
d([
|
|
1873
|
-
m({ converter:
|
|
1874
|
-
],
|
|
1902
|
+
m({ converter: U.csvToArray })
|
|
1903
|
+
], u.prototype, "selected", 2);
|
|
1875
1904
|
d([
|
|
1876
1905
|
m({ type: String })
|
|
1877
|
-
],
|
|
1906
|
+
], u.prototype, "earliest", 2);
|
|
1878
1907
|
d([
|
|
1879
1908
|
m({ type: String })
|
|
1880
|
-
],
|
|
1909
|
+
], u.prototype, "latest", 2);
|
|
1881
1910
|
d([
|
|
1882
|
-
m({ converter:
|
|
1883
|
-
],
|
|
1911
|
+
m({ converter: U.stringsToDate })
|
|
1912
|
+
], u.prototype, "excludedates", 2);
|
|
1884
1913
|
d([
|
|
1885
|
-
m({ converter:
|
|
1886
|
-
],
|
|
1914
|
+
m({ converter: U.csvToArray })
|
|
1915
|
+
], u.prototype, "excludeweekdays", 2);
|
|
1887
1916
|
d([
|
|
1888
|
-
m({ converter:
|
|
1889
|
-
],
|
|
1917
|
+
m({ converter: U.stringToDate })
|
|
1918
|
+
], u.prototype, "currentmonth", 2);
|
|
1890
1919
|
d([
|
|
1891
1920
|
m({ type: Array })
|
|
1892
|
-
],
|
|
1921
|
+
], u.prototype, "dayStrings", 2);
|
|
1893
1922
|
d([
|
|
1894
1923
|
m({ type: Array })
|
|
1895
|
-
],
|
|
1924
|
+
], u.prototype, "dayStringsLong", 2);
|
|
1896
1925
|
d([
|
|
1897
1926
|
m({ type: Array })
|
|
1898
|
-
],
|
|
1927
|
+
], u.prototype, "monthStrings", 2);
|
|
1899
1928
|
d([
|
|
1900
1929
|
m({ type: String })
|
|
1901
|
-
],
|
|
1930
|
+
], u.prototype, "weekString", 2);
|
|
1902
1931
|
d([
|
|
1903
1932
|
m({ type: String })
|
|
1904
|
-
],
|
|
1933
|
+
], u.prototype, "prevMonthString", 2);
|
|
1905
1934
|
d([
|
|
1906
1935
|
m({ type: String })
|
|
1907
|
-
],
|
|
1936
|
+
], u.prototype, "nextMonthString", 2);
|
|
1908
1937
|
d([
|
|
1909
1938
|
m({ type: Array })
|
|
1910
|
-
],
|
|
1939
|
+
], u.prototype, "_selected", 2);
|
|
1911
1940
|
d([
|
|
1912
1941
|
m({ type: Number })
|
|
1913
|
-
],
|
|
1942
|
+
], u.prototype, "year", 2);
|
|
1914
1943
|
d([
|
|
1915
1944
|
m({ type: Number })
|
|
1916
|
-
],
|
|
1945
|
+
], u.prototype, "month", 2);
|
|
1917
1946
|
d([
|
|
1918
1947
|
m({ type: Number })
|
|
1919
|
-
],
|
|
1948
|
+
], u.prototype, "week", 2);
|
|
1920
1949
|
d([
|
|
1921
1950
|
m({ type: Date })
|
|
1922
|
-
],
|
|
1951
|
+
], u.prototype, "rangeHovered", 2);
|
|
1923
1952
|
d([
|
|
1924
|
-
|
|
1925
|
-
],
|
|
1953
|
+
R()
|
|
1954
|
+
], u.prototype, "inRange", 2);
|
|
1926
1955
|
d([
|
|
1927
|
-
|
|
1928
|
-
],
|
|
1956
|
+
R()
|
|
1957
|
+
], u.prototype, "focusedDate", 2);
|
|
1929
1958
|
d([
|
|
1930
|
-
|
|
1931
|
-
],
|
|
1959
|
+
R()
|
|
1960
|
+
], u.prototype, "selectableDates", 2);
|
|
1932
1961
|
d([
|
|
1933
|
-
|
|
1934
|
-
],
|
|
1962
|
+
R()
|
|
1963
|
+
], u.prototype, "currentmonthtouched", 2);
|
|
1935
1964
|
d([
|
|
1936
|
-
|
|
1937
|
-
],
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
],
|
|
1965
|
+
R()
|
|
1966
|
+
], u.prototype, "tabIndexSet", 2);
|
|
1967
|
+
u = d([
|
|
1968
|
+
yt("pkt-calendar")
|
|
1969
|
+
], u);
|
|
1941
1970
|
export {
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1971
|
+
u as P,
|
|
1972
|
+
I as a,
|
|
1973
|
+
Le as b,
|
|
1974
|
+
_e as c,
|
|
1975
|
+
p as d,
|
|
1976
|
+
U as e,
|
|
1977
|
+
Ue as f,
|
|
1978
|
+
ze as i,
|
|
1979
|
+
_ as n,
|
|
1980
|
+
$ as p,
|
|
1981
|
+
Be as s
|
|
1950
1982
|
};
|