@wikicasa-dev/utilities 1.1.2 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/DateUtils.cjs +1 -1
- package/dist/DateUtils.js +135 -127
- package/dist/DeviceDetectionUtils.cjs +1 -1
- package/dist/DeviceDetectionUtils.js +1 -1
- package/dist/RESB_UrlBuilder.cjs +1 -1
- package/dist/RESB_UrlBuilder.js +6 -6
- package/dist/index.cjs +1 -1
- package/dist/index.js +28 -28
- package/dist/{types-DvDE84zi.js → types-CBzIj03u.js} +24 -12
- package/dist/{types-zCVogBEy.cjs → types-CNKgxMk_.cjs} +1 -1
- package/dist/utils/DateUtils.d.ts +9 -18
- package/package.json +2 -2
package/dist/DateUtils.js
CHANGED
|
@@ -9,10 +9,10 @@ function G(r, e) {
|
|
|
9
9
|
const t = p(r);
|
|
10
10
|
return isNaN(e) ? m(r, NaN) : (e && t.setDate(t.getDate() + e), t);
|
|
11
11
|
}
|
|
12
|
-
const te = 6048e5, me = 864e5, we = 6e4, ye = 36e5,
|
|
13
|
-
let
|
|
12
|
+
const te = 6048e5, me = 864e5, we = 6e4, ye = 36e5, ge = 1e3;
|
|
13
|
+
let be = {};
|
|
14
14
|
function _() {
|
|
15
|
-
return
|
|
15
|
+
return be;
|
|
16
16
|
}
|
|
17
17
|
function O(r, e) {
|
|
18
18
|
const t = _(), n = e?.weekStartsOn ?? e?.locale?.options?.weekStartsOn ?? t.weekStartsOn ?? t.locale?.options?.weekStartsOn ?? 0, a = p(r), s = a.getDay(), o = (s < n ? 7 : 0) + s - n;
|
|
@@ -29,11 +29,11 @@ function ne(r) {
|
|
|
29
29
|
const o = W(s);
|
|
30
30
|
return e.getTime() >= a.getTime() ? t + 1 : e.getTime() >= o.getTime() ? t : t - 1;
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function J(r) {
|
|
33
33
|
const e = p(r);
|
|
34
34
|
return e.setHours(0, 0, 0, 0), e;
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function F(r) {
|
|
37
37
|
const e = p(r), t = new Date(
|
|
38
38
|
Date.UTC(
|
|
39
39
|
e.getFullYear(),
|
|
@@ -48,7 +48,7 @@ function L(r) {
|
|
|
48
48
|
return t.setUTCFullYear(e.getFullYear()), +r - +t;
|
|
49
49
|
}
|
|
50
50
|
function pe(r, e) {
|
|
51
|
-
const t =
|
|
51
|
+
const t = J(r), n = J(e), a = +t - F(t), s = +n - F(n);
|
|
52
52
|
return Math.round((a - s) / me);
|
|
53
53
|
}
|
|
54
54
|
function xe(r) {
|
|
@@ -68,7 +68,7 @@ function Pe(r) {
|
|
|
68
68
|
const e = p(r), t = m(r, 0);
|
|
69
69
|
return t.setFullYear(e.getFullYear(), 0, 1), t.setHours(0, 0, 0, 0), t;
|
|
70
70
|
}
|
|
71
|
-
const
|
|
71
|
+
const De = {
|
|
72
72
|
lessThanXSeconds: {
|
|
73
73
|
one: "less than a second",
|
|
74
74
|
other: "less than {{count}} seconds"
|
|
@@ -130,12 +130,12 @@ const Te = {
|
|
|
130
130
|
one: "almost 1 year",
|
|
131
131
|
other: "almost {{count}} years"
|
|
132
132
|
}
|
|
133
|
-
},
|
|
133
|
+
}, Te = (r, e, t) => {
|
|
134
134
|
let n;
|
|
135
|
-
const a =
|
|
135
|
+
const a = De[r];
|
|
136
136
|
return typeof a == "string" ? n = a : e === 1 ? n = a.one : n = a.other.replace("{{count}}", e.toString()), t?.addSuffix ? t.comparison && t.comparison > 0 ? "in " + n : n + " ago" : n;
|
|
137
137
|
};
|
|
138
|
-
function
|
|
138
|
+
function Q(r) {
|
|
139
139
|
return (e = {}) => {
|
|
140
140
|
const t = e.width ? String(e.width) : r.defaultWidth;
|
|
141
141
|
return r.formats[t] || r.formats[r.defaultWidth];
|
|
@@ -157,15 +157,15 @@ const ke = {
|
|
|
157
157
|
medium: "{{date}}, {{time}}",
|
|
158
158
|
short: "{{date}}, {{time}}"
|
|
159
159
|
}, ve = {
|
|
160
|
-
date:
|
|
160
|
+
date: Q({
|
|
161
161
|
formats: ke,
|
|
162
162
|
defaultWidth: "full"
|
|
163
163
|
}),
|
|
164
|
-
time:
|
|
164
|
+
time: Q({
|
|
165
165
|
formats: Oe,
|
|
166
166
|
defaultWidth: "full"
|
|
167
167
|
}),
|
|
168
|
-
dateTime:
|
|
168
|
+
dateTime: Q({
|
|
169
169
|
formats: Ye,
|
|
170
170
|
defaultWidth: "full"
|
|
171
171
|
})
|
|
@@ -243,7 +243,7 @@ const _e = {
|
|
|
243
243
|
"Friday",
|
|
244
244
|
"Saturday"
|
|
245
245
|
]
|
|
246
|
-
},
|
|
246
|
+
}, Fe = {
|
|
247
247
|
narrow: {
|
|
248
248
|
am: "a",
|
|
249
249
|
pm: "p",
|
|
@@ -274,7 +274,7 @@ const _e = {
|
|
|
274
274
|
evening: "evening",
|
|
275
275
|
night: "night"
|
|
276
276
|
}
|
|
277
|
-
},
|
|
277
|
+
}, Le = {
|
|
278
278
|
narrow: {
|
|
279
279
|
am: "a",
|
|
280
280
|
pm: "p",
|
|
@@ -337,9 +337,9 @@ const _e = {
|
|
|
337
337
|
defaultWidth: "wide"
|
|
338
338
|
}),
|
|
339
339
|
dayPeriod: q({
|
|
340
|
-
values:
|
|
340
|
+
values: Fe,
|
|
341
341
|
defaultWidth: "wide",
|
|
342
|
-
formattingValues:
|
|
342
|
+
formattingValues: Le,
|
|
343
343
|
defaultFormattingWidth: "wide"
|
|
344
344
|
})
|
|
345
345
|
};
|
|
@@ -357,8 +357,8 @@ function H(r) {
|
|
|
357
357
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type
|
|
358
358
|
t.valueCallback(x)
|
|
359
359
|
) : x;
|
|
360
|
-
const
|
|
361
|
-
return { value: x, rest:
|
|
360
|
+
const b = e.slice(o.length);
|
|
361
|
+
return { value: x, rest: b };
|
|
362
362
|
};
|
|
363
363
|
}
|
|
364
364
|
function Qe(r, e) {
|
|
@@ -395,11 +395,11 @@ const Ge = /^(\d+)(th|st|nd|rd)?/i, Be = /\d+/i, Ae = {
|
|
|
395
395
|
wide: /^[1234](th|st|nd|rd)? quarter/i
|
|
396
396
|
}, Ve = {
|
|
397
397
|
any: [/1/i, /2/i, /3/i, /4/i]
|
|
398
|
-
},
|
|
398
|
+
}, Ze = {
|
|
399
399
|
narrow: /^[jfmasond]/i,
|
|
400
400
|
abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
|
|
401
401
|
wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
|
|
402
|
-
},
|
|
402
|
+
}, ze = {
|
|
403
403
|
narrow: [
|
|
404
404
|
/^j/i,
|
|
405
405
|
/^f/i,
|
|
@@ -428,7 +428,7 @@ const Ge = /^(\d+)(th|st|nd|rd)?/i, Be = /\d+/i, Ae = {
|
|
|
428
428
|
/^n/i,
|
|
429
429
|
/^d/i
|
|
430
430
|
]
|
|
431
|
-
},
|
|
431
|
+
}, Je = {
|
|
432
432
|
narrow: /^[smtwf]/i,
|
|
433
433
|
short: /^(su|mo|tu|we|th|fr|sa)/i,
|
|
434
434
|
abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
|
|
@@ -470,13 +470,13 @@ const Ge = /^(\d+)(th|st|nd|rd)?/i, Be = /\d+/i, Ae = {
|
|
|
470
470
|
valueCallback: (r) => r + 1
|
|
471
471
|
}),
|
|
472
472
|
month: H({
|
|
473
|
-
matchPatterns:
|
|
473
|
+
matchPatterns: Ze,
|
|
474
474
|
defaultMatchWidth: "wide",
|
|
475
|
-
parsePatterns:
|
|
475
|
+
parsePatterns: ze,
|
|
476
476
|
defaultParseWidth: "any"
|
|
477
477
|
}),
|
|
478
478
|
day: H({
|
|
479
|
-
matchPatterns:
|
|
479
|
+
matchPatterns: Je,
|
|
480
480
|
defaultMatchWidth: "wide",
|
|
481
481
|
parsePatterns: Ke,
|
|
482
482
|
defaultParseWidth: "any"
|
|
@@ -489,7 +489,7 @@ const Ge = /^(\d+)(th|st|nd|rd)?/i, Be = /\d+/i, Ae = {
|
|
|
489
489
|
})
|
|
490
490
|
}, ae = {
|
|
491
491
|
code: "en-US",
|
|
492
|
-
formatDistance:
|
|
492
|
+
formatDistance: Te,
|
|
493
493
|
formatLong: ve,
|
|
494
494
|
formatRelative: We,
|
|
495
495
|
localize: Ie,
|
|
@@ -1134,7 +1134,7 @@ const ee = (r, e) => {
|
|
|
1134
1134
|
break;
|
|
1135
1135
|
}
|
|
1136
1136
|
return s.replace("{{date}}", ee(n, e)).replace("{{time}}", ie(a, e));
|
|
1137
|
-
},
|
|
1137
|
+
}, R = {
|
|
1138
1138
|
p: ie,
|
|
1139
1139
|
P: rt
|
|
1140
1140
|
}, at = /^D+$/, st = /^Y+$/, ot = ["D", "DD", "YY", "YYYY"];
|
|
@@ -1144,7 +1144,7 @@ function ue(r) {
|
|
|
1144
1144
|
function ce(r) {
|
|
1145
1145
|
return st.test(r);
|
|
1146
1146
|
}
|
|
1147
|
-
function
|
|
1147
|
+
function X(r, e, t) {
|
|
1148
1148
|
const n = it(r, e, t);
|
|
1149
1149
|
if (console.warn(n), ot.includes(r)) throw new RangeError(n);
|
|
1150
1150
|
}
|
|
@@ -1153,30 +1153,30 @@ function it(r, e, t) {
|
|
|
1153
1153
|
return `Use \`${r.toLowerCase()}\` instead of \`${r}\` (in \`${e}\`) for formatting ${n} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
|
|
1154
1154
|
}
|
|
1155
1155
|
const ut = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g, ct = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g, dt = /^'([^]*?)'?$/, lt = /''/g, ft = /[a-zA-Z]/;
|
|
1156
|
-
function
|
|
1156
|
+
function L(r, e, t) {
|
|
1157
1157
|
const n = _(), a = n.locale ?? ae, s = n.firstWeekContainsDate ?? n.locale?.options?.firstWeekContainsDate ?? 1, o = n.weekStartsOn ?? n.locale?.options?.weekStartsOn ?? 0, d = p(r);
|
|
1158
1158
|
if (!re(d))
|
|
1159
1159
|
throw new RangeError("Invalid time value");
|
|
1160
|
-
let M = e.match(ct).map((
|
|
1161
|
-
const f =
|
|
1160
|
+
let M = e.match(ct).map((b) => {
|
|
1161
|
+
const f = b[0];
|
|
1162
1162
|
if (f === "p" || f === "P") {
|
|
1163
|
-
const N =
|
|
1164
|
-
return N(
|
|
1163
|
+
const N = R[f];
|
|
1164
|
+
return N(b, a.formatLong);
|
|
1165
1165
|
}
|
|
1166
|
-
return
|
|
1167
|
-
}).join("").match(ut).map((
|
|
1168
|
-
if (
|
|
1166
|
+
return b;
|
|
1167
|
+
}).join("").match(ut).map((b) => {
|
|
1168
|
+
if (b === "''")
|
|
1169
1169
|
return { isToken: !1, value: "'" };
|
|
1170
|
-
const f =
|
|
1170
|
+
const f = b[0];
|
|
1171
1171
|
if (f === "'")
|
|
1172
|
-
return { isToken: !1, value: ht(
|
|
1172
|
+
return { isToken: !1, value: ht(b) };
|
|
1173
1173
|
if (K[f])
|
|
1174
|
-
return { isToken: !0, value:
|
|
1174
|
+
return { isToken: !0, value: b };
|
|
1175
1175
|
if (f.match(ft))
|
|
1176
1176
|
throw new RangeError(
|
|
1177
1177
|
"Format string contains an unescaped latin alphabet character `" + f + "`"
|
|
1178
1178
|
);
|
|
1179
|
-
return { isToken: !1, value:
|
|
1179
|
+
return { isToken: !1, value: b };
|
|
1180
1180
|
});
|
|
1181
1181
|
a.localize.preprocessor && (M = a.localize.preprocessor(d, M));
|
|
1182
1182
|
const x = {
|
|
@@ -1184,10 +1184,10 @@ function X(r, e, t) {
|
|
|
1184
1184
|
weekStartsOn: o,
|
|
1185
1185
|
locale: a
|
|
1186
1186
|
};
|
|
1187
|
-
return M.map((
|
|
1188
|
-
if (!
|
|
1189
|
-
const f =
|
|
1190
|
-
(ce(f) || ue(f)) &&
|
|
1187
|
+
return M.map((b) => {
|
|
1188
|
+
if (!b.isToken) return b.value;
|
|
1189
|
+
const f = b.value;
|
|
1190
|
+
(ce(f) || ue(f)) && X(f, e, String(r));
|
|
1191
1191
|
const N = K[f[0]];
|
|
1192
1192
|
return N(d, f, a.localize, x);
|
|
1193
1193
|
}).join("");
|
|
@@ -1216,14 +1216,14 @@ function yt(r, e) {
|
|
|
1216
1216
|
r.getMilliseconds()
|
|
1217
1217
|
), t;
|
|
1218
1218
|
}
|
|
1219
|
-
const
|
|
1219
|
+
const gt = 10;
|
|
1220
1220
|
class de {
|
|
1221
1221
|
subPriority = 0;
|
|
1222
1222
|
validate(e, t) {
|
|
1223
1223
|
return !0;
|
|
1224
1224
|
}
|
|
1225
1225
|
}
|
|
1226
|
-
class
|
|
1226
|
+
class bt extends de {
|
|
1227
1227
|
constructor(e, t, n, a, s) {
|
|
1228
1228
|
super(), this.value = e, this.validateValue = t, this.setValue = n, this.priority = a, s && (this.subPriority = s);
|
|
1229
1229
|
}
|
|
@@ -1235,7 +1235,7 @@ class gt extends de {
|
|
|
1235
1235
|
}
|
|
1236
1236
|
}
|
|
1237
1237
|
class pt extends de {
|
|
1238
|
-
priority =
|
|
1238
|
+
priority = gt;
|
|
1239
1239
|
subPriority = -1;
|
|
1240
1240
|
set(e, t) {
|
|
1241
1241
|
return t.timestampIsSet ? e : m(e, yt(e, Date));
|
|
@@ -1245,7 +1245,7 @@ class u {
|
|
|
1245
1245
|
run(e, t, n, a) {
|
|
1246
1246
|
const s = this.parse(e, t, n, a);
|
|
1247
1247
|
return s ? {
|
|
1248
|
-
setter: new
|
|
1248
|
+
setter: new bt(
|
|
1249
1249
|
s.value,
|
|
1250
1250
|
this.validate,
|
|
1251
1251
|
this.set,
|
|
@@ -1317,14 +1317,14 @@ const y = {
|
|
|
1317
1317
|
// 0 to 999, -0 to -999
|
|
1318
1318
|
fourDigitsSigned: /^-?\d{1,4}/
|
|
1319
1319
|
// 0 to 9999, -0 to -9999
|
|
1320
|
-
},
|
|
1320
|
+
}, D = {
|
|
1321
1321
|
basicOptionalMinutes: /^([+-])(\d{2})(\d{2})?|Z/,
|
|
1322
1322
|
basic: /^([+-])(\d{2})(\d{2})|Z/,
|
|
1323
1323
|
basicOptionalSeconds: /^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,
|
|
1324
1324
|
extended: /^([+-])(\d{2}):(\d{2})|Z/,
|
|
1325
1325
|
extendedOptionalSeconds: /^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/
|
|
1326
1326
|
};
|
|
1327
|
-
function
|
|
1327
|
+
function g(r, e) {
|
|
1328
1328
|
return r && {
|
|
1329
1329
|
value: e(r.value),
|
|
1330
1330
|
rest: r.rest
|
|
@@ -1337,7 +1337,7 @@ function l(r, e) {
|
|
|
1337
1337
|
rest: e.slice(t[0].length)
|
|
1338
1338
|
} : null;
|
|
1339
1339
|
}
|
|
1340
|
-
function
|
|
1340
|
+
function T(r, e) {
|
|
1341
1341
|
const t = e.match(r);
|
|
1342
1342
|
if (!t)
|
|
1343
1343
|
return null;
|
|
@@ -1348,7 +1348,7 @@ function D(r, e) {
|
|
|
1348
1348
|
};
|
|
1349
1349
|
const n = t[1] === "+" ? 1 : -1, a = t[2] ? parseInt(t[2], 10) : 0, s = t[3] ? parseInt(t[3], 10) : 0, o = t[5] ? parseInt(t[5], 10) : 0;
|
|
1350
1350
|
return {
|
|
1351
|
-
value: n * (a * ye + s * we + o *
|
|
1351
|
+
value: n * (a * ye + s * we + o * ge),
|
|
1352
1352
|
rest: e.slice(t[0].length)
|
|
1353
1353
|
};
|
|
1354
1354
|
}
|
|
@@ -1369,7 +1369,7 @@ function w(r, e) {
|
|
|
1369
1369
|
return l(new RegExp("^\\d{1," + r + "}"), e);
|
|
1370
1370
|
}
|
|
1371
1371
|
}
|
|
1372
|
-
function
|
|
1372
|
+
function C(r, e) {
|
|
1373
1373
|
switch (r) {
|
|
1374
1374
|
case 1:
|
|
1375
1375
|
return l(y.singleDigitSigned, e);
|
|
@@ -1424,16 +1424,16 @@ class Mt extends u {
|
|
|
1424
1424
|
});
|
|
1425
1425
|
switch (t) {
|
|
1426
1426
|
case "y":
|
|
1427
|
-
return
|
|
1427
|
+
return g(w(4, e), a);
|
|
1428
1428
|
case "yo":
|
|
1429
|
-
return
|
|
1429
|
+
return g(
|
|
1430
1430
|
n.ordinalNumber(e, {
|
|
1431
1431
|
unit: "year"
|
|
1432
1432
|
}),
|
|
1433
1433
|
a
|
|
1434
1434
|
);
|
|
1435
1435
|
default:
|
|
1436
|
-
return
|
|
1436
|
+
return g(w(t.length, e), a);
|
|
1437
1437
|
}
|
|
1438
1438
|
}
|
|
1439
1439
|
validate(e, t) {
|
|
@@ -1461,16 +1461,16 @@ class Pt extends u {
|
|
|
1461
1461
|
});
|
|
1462
1462
|
switch (t) {
|
|
1463
1463
|
case "Y":
|
|
1464
|
-
return
|
|
1464
|
+
return g(w(4, e), a);
|
|
1465
1465
|
case "Yo":
|
|
1466
|
-
return
|
|
1466
|
+
return g(
|
|
1467
1467
|
n.ordinalNumber(e, {
|
|
1468
1468
|
unit: "year"
|
|
1469
1469
|
}),
|
|
1470
1470
|
a
|
|
1471
1471
|
);
|
|
1472
1472
|
default:
|
|
1473
|
-
return
|
|
1473
|
+
return g(w(t.length, e), a);
|
|
1474
1474
|
}
|
|
1475
1475
|
}
|
|
1476
1476
|
validate(e, t) {
|
|
@@ -1508,10 +1508,10 @@ class Pt extends u {
|
|
|
1508
1508
|
"T"
|
|
1509
1509
|
];
|
|
1510
1510
|
}
|
|
1511
|
-
class
|
|
1511
|
+
class Dt extends u {
|
|
1512
1512
|
priority = 130;
|
|
1513
1513
|
parse(e, t) {
|
|
1514
|
-
return
|
|
1514
|
+
return C(t === "R" ? 4 : t.length, e);
|
|
1515
1515
|
}
|
|
1516
1516
|
set(e, t, n) {
|
|
1517
1517
|
const a = m(e, 0);
|
|
@@ -1535,10 +1535,10 @@ class Tt extends u {
|
|
|
1535
1535
|
"T"
|
|
1536
1536
|
];
|
|
1537
1537
|
}
|
|
1538
|
-
class
|
|
1538
|
+
class Tt extends u {
|
|
1539
1539
|
priority = 130;
|
|
1540
1540
|
parse(e, t) {
|
|
1541
|
-
return
|
|
1541
|
+
return C(t === "u" ? 4 : t.length, e);
|
|
1542
1542
|
}
|
|
1543
1543
|
set(e, t, n) {
|
|
1544
1544
|
return e.setFullYear(n, 0, 1), e.setHours(0, 0, 0, 0), e;
|
|
@@ -1684,14 +1684,14 @@ class Yt extends u {
|
|
|
1684
1684
|
const a = (s) => s - 1;
|
|
1685
1685
|
switch (t) {
|
|
1686
1686
|
case "M":
|
|
1687
|
-
return
|
|
1687
|
+
return g(
|
|
1688
1688
|
l(y.month, e),
|
|
1689
1689
|
a
|
|
1690
1690
|
);
|
|
1691
1691
|
case "MM":
|
|
1692
|
-
return
|
|
1692
|
+
return g(w(2, e), a);
|
|
1693
1693
|
case "Mo":
|
|
1694
|
-
return
|
|
1694
|
+
return g(
|
|
1695
1695
|
n.ordinalNumber(e, {
|
|
1696
1696
|
unit: "month"
|
|
1697
1697
|
}),
|
|
@@ -1728,14 +1728,14 @@ class vt extends u {
|
|
|
1728
1728
|
const a = (s) => s - 1;
|
|
1729
1729
|
switch (t) {
|
|
1730
1730
|
case "L":
|
|
1731
|
-
return
|
|
1731
|
+
return g(
|
|
1732
1732
|
l(y.month, e),
|
|
1733
1733
|
a
|
|
1734
1734
|
);
|
|
1735
1735
|
case "LL":
|
|
1736
|
-
return
|
|
1736
|
+
return g(w(2, e), a);
|
|
1737
1737
|
case "Lo":
|
|
1738
|
-
return
|
|
1738
|
+
return g(
|
|
1739
1739
|
n.ordinalNumber(e, {
|
|
1740
1740
|
unit: "month"
|
|
1741
1741
|
}),
|
|
@@ -1872,7 +1872,7 @@ const qt = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], Ht = [
|
|
|
1872
1872
|
30,
|
|
1873
1873
|
31
|
|
1874
1874
|
];
|
|
1875
|
-
class
|
|
1875
|
+
class Ft extends u {
|
|
1876
1876
|
priority = 90;
|
|
1877
1877
|
subPriority = 1;
|
|
1878
1878
|
parse(e, t, n) {
|
|
@@ -1907,7 +1907,7 @@ class Lt extends u {
|
|
|
1907
1907
|
"T"
|
|
1908
1908
|
];
|
|
1909
1909
|
}
|
|
1910
|
-
class
|
|
1910
|
+
class Lt extends u {
|
|
1911
1911
|
priority = 90;
|
|
1912
1912
|
subpriority = 1;
|
|
1913
1913
|
parse(e, t, n) {
|
|
@@ -1947,8 +1947,8 @@ class Ft extends u {
|
|
|
1947
1947
|
];
|
|
1948
1948
|
}
|
|
1949
1949
|
function $(r, e, t) {
|
|
1950
|
-
const n = _(), a = t?.weekStartsOn ?? t?.locale?.options?.weekStartsOn ?? n.weekStartsOn ?? n.locale?.options?.weekStartsOn ?? 0, s = p(r), o = s.getDay(), M = (e % 7 + 7) % 7, x = 7 - a,
|
|
1951
|
-
return G(s,
|
|
1950
|
+
const n = _(), a = t?.weekStartsOn ?? t?.locale?.options?.weekStartsOn ?? n.weekStartsOn ?? n.locale?.options?.weekStartsOn ?? 0, s = p(r), o = s.getDay(), M = (e % 7 + 7) % 7, x = 7 - a, b = e < 0 || e > 6 ? e - (o + x) % 7 : (M + x) % 7 - (o + x) % 7;
|
|
1951
|
+
return G(s, b);
|
|
1952
1952
|
}
|
|
1953
1953
|
class Ct extends u {
|
|
1954
1954
|
priority = 90;
|
|
@@ -1994,9 +1994,9 @@ class It extends u {
|
|
|
1994
1994
|
switch (t) {
|
|
1995
1995
|
case "e":
|
|
1996
1996
|
case "ee":
|
|
1997
|
-
return
|
|
1997
|
+
return g(w(t.length, e), s);
|
|
1998
1998
|
case "eo":
|
|
1999
|
-
return
|
|
1999
|
+
return g(
|
|
2000
2000
|
n.ordinalNumber(e, {
|
|
2001
2001
|
unit: "day"
|
|
2002
2002
|
}),
|
|
@@ -2056,9 +2056,9 @@ class Qt extends u {
|
|
|
2056
2056
|
switch (t) {
|
|
2057
2057
|
case "c":
|
|
2058
2058
|
case "cc":
|
|
2059
|
-
return
|
|
2059
|
+
return g(w(t.length, e), s);
|
|
2060
2060
|
case "co":
|
|
2061
|
-
return
|
|
2061
|
+
return g(
|
|
2062
2062
|
n.ordinalNumber(e, {
|
|
2063
2063
|
unit: "day"
|
|
2064
2064
|
}),
|
|
@@ -2123,7 +2123,7 @@ class Xt extends u {
|
|
|
2123
2123
|
case "io":
|
|
2124
2124
|
return n.ordinalNumber(e, { unit: "day" });
|
|
2125
2125
|
case "iii":
|
|
2126
|
-
return
|
|
2126
|
+
return g(
|
|
2127
2127
|
n.day(e, {
|
|
2128
2128
|
width: "abbreviated",
|
|
2129
2129
|
context: "formatting"
|
|
@@ -2137,7 +2137,7 @@ class Xt extends u {
|
|
|
2137
2137
|
a
|
|
2138
2138
|
);
|
|
2139
2139
|
case "iiiii":
|
|
2140
|
-
return
|
|
2140
|
+
return g(
|
|
2141
2141
|
n.day(e, {
|
|
2142
2142
|
width: "narrow",
|
|
2143
2143
|
context: "formatting"
|
|
@@ -2145,7 +2145,7 @@ class Xt extends u {
|
|
|
2145
2145
|
a
|
|
2146
2146
|
);
|
|
2147
2147
|
case "iiiiii":
|
|
2148
|
-
return
|
|
2148
|
+
return g(
|
|
2149
2149
|
n.day(e, {
|
|
2150
2150
|
width: "short",
|
|
2151
2151
|
context: "formatting"
|
|
@@ -2157,7 +2157,7 @@ class Xt extends u {
|
|
|
2157
2157
|
);
|
|
2158
2158
|
case "iiii":
|
|
2159
2159
|
default:
|
|
2160
|
-
return
|
|
2160
|
+
return g(
|
|
2161
2161
|
n.day(e, {
|
|
2162
2162
|
width: "wide",
|
|
2163
2163
|
context: "formatting"
|
|
@@ -2374,7 +2374,7 @@ class Vt extends u {
|
|
|
2374
2374
|
}
|
|
2375
2375
|
incompatibleTokens = ["h", "H", "k", "t", "T"];
|
|
2376
2376
|
}
|
|
2377
|
-
class
|
|
2377
|
+
class Zt extends u {
|
|
2378
2378
|
priority = 70;
|
|
2379
2379
|
parse(e, t, n) {
|
|
2380
2380
|
switch (t) {
|
|
@@ -2395,7 +2395,7 @@ class zt extends u {
|
|
|
2395
2395
|
}
|
|
2396
2396
|
incompatibleTokens = ["a", "b", "h", "H", "K", "t", "T"];
|
|
2397
2397
|
}
|
|
2398
|
-
class
|
|
2398
|
+
class zt extends u {
|
|
2399
2399
|
priority = 60;
|
|
2400
2400
|
parse(e, t, n) {
|
|
2401
2401
|
switch (t) {
|
|
@@ -2415,7 +2415,7 @@ class Jt extends u {
|
|
|
2415
2415
|
}
|
|
2416
2416
|
incompatibleTokens = ["t", "T"];
|
|
2417
2417
|
}
|
|
2418
|
-
class
|
|
2418
|
+
class Jt extends u {
|
|
2419
2419
|
priority = 50;
|
|
2420
2420
|
parse(e, t, n) {
|
|
2421
2421
|
switch (t) {
|
|
@@ -2439,7 +2439,7 @@ class Kt extends u {
|
|
|
2439
2439
|
priority = 30;
|
|
2440
2440
|
parse(e, t) {
|
|
2441
2441
|
const n = (a) => Math.trunc(a * Math.pow(10, -t.length + 3));
|
|
2442
|
-
return
|
|
2442
|
+
return g(w(t.length, e), n);
|
|
2443
2443
|
}
|
|
2444
2444
|
set(e, t, n) {
|
|
2445
2445
|
return e.setMilliseconds(n), e;
|
|
@@ -2451,31 +2451,31 @@ class Ut extends u {
|
|
|
2451
2451
|
parse(e, t) {
|
|
2452
2452
|
switch (t) {
|
|
2453
2453
|
case "X":
|
|
2454
|
-
return
|
|
2455
|
-
|
|
2454
|
+
return T(
|
|
2455
|
+
D.basicOptionalMinutes,
|
|
2456
2456
|
e
|
|
2457
2457
|
);
|
|
2458
2458
|
case "XX":
|
|
2459
|
-
return D
|
|
2459
|
+
return T(D.basic, e);
|
|
2460
2460
|
case "XXXX":
|
|
2461
|
-
return
|
|
2462
|
-
|
|
2461
|
+
return T(
|
|
2462
|
+
D.basicOptionalSeconds,
|
|
2463
2463
|
e
|
|
2464
2464
|
);
|
|
2465
2465
|
case "XXXXX":
|
|
2466
|
-
return
|
|
2467
|
-
|
|
2466
|
+
return T(
|
|
2467
|
+
D.extendedOptionalSeconds,
|
|
2468
2468
|
e
|
|
2469
2469
|
);
|
|
2470
2470
|
case "XXX":
|
|
2471
2471
|
default:
|
|
2472
|
-
return D
|
|
2472
|
+
return T(D.extended, e);
|
|
2473
2473
|
}
|
|
2474
2474
|
}
|
|
2475
2475
|
set(e, t, n) {
|
|
2476
2476
|
return t.timestampIsSet ? e : m(
|
|
2477
2477
|
e,
|
|
2478
|
-
e.getTime() -
|
|
2478
|
+
e.getTime() - F(e) - n
|
|
2479
2479
|
);
|
|
2480
2480
|
}
|
|
2481
2481
|
incompatibleTokens = ["t", "T", "x"];
|
|
@@ -2485,31 +2485,31 @@ class St extends u {
|
|
|
2485
2485
|
parse(e, t) {
|
|
2486
2486
|
switch (t) {
|
|
2487
2487
|
case "x":
|
|
2488
|
-
return
|
|
2489
|
-
|
|
2488
|
+
return T(
|
|
2489
|
+
D.basicOptionalMinutes,
|
|
2490
2490
|
e
|
|
2491
2491
|
);
|
|
2492
2492
|
case "xx":
|
|
2493
|
-
return D
|
|
2493
|
+
return T(D.basic, e);
|
|
2494
2494
|
case "xxxx":
|
|
2495
|
-
return
|
|
2496
|
-
|
|
2495
|
+
return T(
|
|
2496
|
+
D.basicOptionalSeconds,
|
|
2497
2497
|
e
|
|
2498
2498
|
);
|
|
2499
2499
|
case "xxxxx":
|
|
2500
|
-
return
|
|
2501
|
-
|
|
2500
|
+
return T(
|
|
2501
|
+
D.extendedOptionalSeconds,
|
|
2502
2502
|
e
|
|
2503
2503
|
);
|
|
2504
2504
|
case "xxx":
|
|
2505
2505
|
default:
|
|
2506
|
-
return D
|
|
2506
|
+
return T(D.extended, e);
|
|
2507
2507
|
}
|
|
2508
2508
|
}
|
|
2509
2509
|
set(e, t, n) {
|
|
2510
2510
|
return t.timestampIsSet ? e : m(
|
|
2511
2511
|
e,
|
|
2512
|
-
e.getTime() -
|
|
2512
|
+
e.getTime() - F(e) - n
|
|
2513
2513
|
);
|
|
2514
2514
|
}
|
|
2515
2515
|
incompatibleTokens = ["t", "T", "X"];
|
|
@@ -2538,16 +2538,16 @@ const nn = {
|
|
|
2538
2538
|
G: new xt(),
|
|
2539
2539
|
y: new Mt(),
|
|
2540
2540
|
Y: new Pt(),
|
|
2541
|
-
R: new
|
|
2542
|
-
u: new
|
|
2541
|
+
R: new Dt(),
|
|
2542
|
+
u: new Tt(),
|
|
2543
2543
|
Q: new kt(),
|
|
2544
2544
|
q: new Ot(),
|
|
2545
2545
|
M: new Yt(),
|
|
2546
2546
|
L: new vt(),
|
|
2547
2547
|
w: new Wt(),
|
|
2548
2548
|
I: new Nt(),
|
|
2549
|
-
d: new
|
|
2550
|
-
D: new
|
|
2549
|
+
d: new Ft(),
|
|
2550
|
+
D: new Lt(),
|
|
2551
2551
|
E: new Ct(),
|
|
2552
2552
|
e: new It(),
|
|
2553
2553
|
c: new Qt(),
|
|
@@ -2558,9 +2558,9 @@ const nn = {
|
|
|
2558
2558
|
h: new $t(),
|
|
2559
2559
|
H: new jt(),
|
|
2560
2560
|
K: new Vt(),
|
|
2561
|
-
k: new
|
|
2562
|
-
m: new
|
|
2563
|
-
s: new
|
|
2561
|
+
k: new Zt(),
|
|
2562
|
+
m: new zt(),
|
|
2563
|
+
s: new Jt(),
|
|
2564
2564
|
S: new Kt(),
|
|
2565
2565
|
X: new Ut(),
|
|
2566
2566
|
x: new St(),
|
|
@@ -2575,41 +2575,41 @@ function dn(r, e, t, n) {
|
|
|
2575
2575
|
firstWeekContainsDate: o,
|
|
2576
2576
|
weekStartsOn: d,
|
|
2577
2577
|
locale: s
|
|
2578
|
-
}, x = [new pt()],
|
|
2578
|
+
}, x = [new pt()], b = e.match(an).map((i) => {
|
|
2579
2579
|
const h = i[0];
|
|
2580
|
-
if (h in
|
|
2581
|
-
const P =
|
|
2580
|
+
if (h in R) {
|
|
2581
|
+
const P = R[h];
|
|
2582
2582
|
return P(i, s.formatLong);
|
|
2583
2583
|
}
|
|
2584
2584
|
return i;
|
|
2585
2585
|
}).join("").match(rn), f = [];
|
|
2586
|
-
for (let i of
|
|
2587
|
-
ce(i) &&
|
|
2586
|
+
for (let i of b) {
|
|
2587
|
+
ce(i) && X(i, e, r), ue(i) && X(i, e, r);
|
|
2588
2588
|
const h = i[0], P = nn[h];
|
|
2589
2589
|
if (P) {
|
|
2590
2590
|
const { incompatibleTokens: V } = P;
|
|
2591
2591
|
if (Array.isArray(V)) {
|
|
2592
|
-
const
|
|
2593
|
-
(
|
|
2592
|
+
const Z = f.find(
|
|
2593
|
+
(z) => V.includes(z.token) || z.token === h
|
|
2594
2594
|
);
|
|
2595
|
-
if (
|
|
2595
|
+
if (Z)
|
|
2596
2596
|
throw new RangeError(
|
|
2597
|
-
`The format string mustn't contain \`${
|
|
2597
|
+
`The format string mustn't contain \`${Z.fullToken}\` and \`${i}\` at the same time`
|
|
2598
2598
|
);
|
|
2599
2599
|
} else if (P.incompatibleTokens === "*" && f.length > 0)
|
|
2600
2600
|
throw new RangeError(
|
|
2601
2601
|
`The format string mustn't contain \`${i}\` and any other token at the same time`
|
|
2602
2602
|
);
|
|
2603
2603
|
f.push({ token: h, fullToken: i });
|
|
2604
|
-
const
|
|
2604
|
+
const I = P.run(
|
|
2605
2605
|
r,
|
|
2606
2606
|
i,
|
|
2607
2607
|
s.match,
|
|
2608
2608
|
M
|
|
2609
2609
|
);
|
|
2610
|
-
if (!
|
|
2610
|
+
if (!I)
|
|
2611
2611
|
return m(t, NaN);
|
|
2612
|
-
x.push(
|
|
2612
|
+
x.push(I.setter), r = I.rest;
|
|
2613
2613
|
} else {
|
|
2614
2614
|
if (h.match(cn))
|
|
2615
2615
|
throw new RangeError(
|
|
@@ -2651,17 +2651,25 @@ function hn(r, e = !1) {
|
|
|
2651
2651
|
const mn = (r) => {
|
|
2652
2652
|
if (typeof r == "string") {
|
|
2653
2653
|
const e = new Date(r);
|
|
2654
|
-
return isNaN(e.valueOf()) ? "" :
|
|
2654
|
+
return isNaN(e.valueOf()) ? "" : L(e, "dd/MM/yyyy");
|
|
2655
2655
|
}
|
|
2656
|
-
return
|
|
2656
|
+
return L(r, "dd/MM/yyyy");
|
|
2657
2657
|
}, wn = (r = /* @__PURE__ */ new Date(), e) => (e < 0 && (e = 0), fn(r, e));
|
|
2658
2658
|
function yn(r) {
|
|
2659
|
-
const
|
|
2660
|
-
|
|
2659
|
+
const t = ["yyyy-MM-dd", "yyyy/MM/dd", "dd/MM/yyyy", "dd-MM-yyyy"].map((n) => dn(r, n, /* @__PURE__ */ new Date())).find((n) => re(n));
|
|
2660
|
+
if (t) {
|
|
2661
|
+
const n = new Date(Date.UTC(t.getFullYear(), t.getMonth(), t.getDate(), 0, 0, 0)), a = new Date(Date.UTC(t.getFullYear(), t.getMonth(), t.getDate(), 23, 59, 59));
|
|
2662
|
+
return {
|
|
2663
|
+
start: L(n, "yyyy-MM-dd'T'HH:mm:ss'Z'"),
|
|
2664
|
+
// Format in ISO 8601
|
|
2665
|
+
end: L(a, "yyyy-MM-dd'T'HH:mm:ss'Z'")
|
|
2666
|
+
};
|
|
2667
|
+
}
|
|
2668
|
+
return { start: null, end: null };
|
|
2661
2669
|
}
|
|
2662
2670
|
export {
|
|
2663
2671
|
hn as formatDate,
|
|
2664
2672
|
mn as formatDateToddMMYYYY,
|
|
2665
|
-
yn as
|
|
2673
|
+
yn as getStartAndEndOfDayUTC,
|
|
2666
2674
|
wn as subtractDaysFromDate
|
|
2667
2675
|
};
|