@bbn/bbn 2.0.24 → 2.0.25
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/bbn.js +1 -1
- package/dist/bbn.js.map +1 -1
- package/dist/dt/functions/buildLocaleFromIntl.d.ts +1 -6
- package/dist/dt/functions/buildLocaleFromIntl.js +7 -2
- package/dist/dt/functions/parse.js +6 -5
- package/dist/dt.d.ts +1 -0
- package/dist/dt.js +1 -0
- package/package.json +1 -1
- package/dist/dt/vars/locales.d.ts +0 -2
- package/dist/dt/vars/locales.js +0 -5
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
import extend from "../../fn/object/extend.js";
|
|
2
|
+
import numProperties from "../../fn/object/numProperties.js";
|
|
1
3
|
export default function buildLocaleFromIntl() {
|
|
4
|
+
if (numProperties(bbn.dt.locales)) {
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
2
7
|
const langs = [bbn.env.lang, ...navigator.languages];
|
|
3
8
|
const fmtMonthLong = new Intl.DateTimeFormat(langs, { month: 'long' });
|
|
4
9
|
const fmtMonthShort = new Intl.DateTimeFormat(langs, { month: 'short' });
|
|
@@ -22,11 +27,11 @@ export default function buildLocaleFromIntl() {
|
|
|
22
27
|
weekdaysLong.push(fmtWeekLong.format(d));
|
|
23
28
|
weekdaysShort.push(fmtWeekShort.format(d));
|
|
24
29
|
}
|
|
25
|
-
|
|
30
|
+
extend(bbn.dt.locales, {
|
|
26
31
|
monthsLong,
|
|
27
32
|
monthsShort,
|
|
28
33
|
weekdaysLong,
|
|
29
34
|
weekdaysShort,
|
|
30
|
-
};
|
|
35
|
+
});
|
|
31
36
|
}
|
|
32
37
|
;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import
|
|
1
|
+
import buildLocaleFromIntl from './buildLocaleFromIntl.js';
|
|
2
2
|
export default function parse(input, format, locale) {
|
|
3
3
|
var _a, _b, _c, _d;
|
|
4
|
+
buildLocaleFromIntl();
|
|
4
5
|
const TemporalAny = globalThis.Temporal;
|
|
5
6
|
if (!TemporalAny) {
|
|
6
7
|
throw new Error('Temporal API is required (load @js-temporal/polyfill)');
|
|
7
8
|
}
|
|
8
9
|
const T = TemporalAny;
|
|
9
10
|
const loc = {
|
|
10
|
-
monthsLong: (_a = locale === null || locale === void 0 ? void 0 : locale.monthsLong) !== null && _a !== void 0 ? _a : locales.monthsLong,
|
|
11
|
-
monthsShort: (_b = locale === null || locale === void 0 ? void 0 : locale.monthsShort) !== null && _b !== void 0 ? _b : locales.monthsShort,
|
|
12
|
-
weekdaysLong: (_c = locale === null || locale === void 0 ? void 0 : locale.weekdaysLong) !== null && _c !== void 0 ? _c : locales.weekdaysLong,
|
|
13
|
-
weekdaysShort: (_d = locale === null || locale === void 0 ? void 0 : locale.weekdaysShort) !== null && _d !== void 0 ? _d : locales.weekdaysShort
|
|
11
|
+
monthsLong: (_a = locale === null || locale === void 0 ? void 0 : locale.monthsLong) !== null && _a !== void 0 ? _a : bbn.dt.locales.monthsLong,
|
|
12
|
+
monthsShort: (_b = locale === null || locale === void 0 ? void 0 : locale.monthsShort) !== null && _b !== void 0 ? _b : bbn.dt.locales.monthsShort,
|
|
13
|
+
weekdaysLong: (_c = locale === null || locale === void 0 ? void 0 : locale.weekdaysLong) !== null && _c !== void 0 ? _c : bbn.dt.locales.weekdaysLong,
|
|
14
|
+
weekdaysShort: (_d = locale === null || locale === void 0 ? void 0 : locale.weekdaysShort) !== null && _d !== void 0 ? _d : bbn.dt.locales.weekdaysShort
|
|
14
15
|
};
|
|
15
16
|
const escapeRegex = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
16
17
|
const makeTokenSpecs = () => [
|
package/dist/dt.d.ts
CHANGED
package/dist/dt.js
CHANGED
package/package.json
CHANGED