@bbn/bbn 2.0.54 → 2.0.55
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.
|
@@ -24,6 +24,6 @@ type CommonFormats = {
|
|
|
24
24
|
* - Time: hour / hour:minute / hour:minute:second (+ optional TZ).
|
|
25
25
|
* - Datetime: only full dates (Y-M-D ± weekday) combined with time.
|
|
26
26
|
*/
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
export {};
|
|
27
|
+
declare const getCommonFormatsForLocale: (lng?: string | string[]) => CommonFormats;
|
|
28
|
+
declare const buildLocaleFromIntl: () => void;
|
|
29
|
+
export { getCommonFormatsForLocale, buildLocaleFromIntl };
|
|
@@ -124,7 +124,7 @@ const partsToPattern = (parts, resolved, requestedOpts) => {
|
|
|
124
124
|
* - Time: hour / hour:minute / hour:minute:second (+ optional TZ).
|
|
125
125
|
* - Datetime: only full dates (Y-M-D ± weekday) combined with time.
|
|
126
126
|
*/
|
|
127
|
-
|
|
127
|
+
const getCommonFormatsForLocale = (lng) => {
|
|
128
128
|
if (!lng) {
|
|
129
129
|
lng = [bbn.env.lang, ...navigator.languages];
|
|
130
130
|
}
|
|
@@ -218,8 +218,8 @@ export function getCommonFormatsForLocale(lng) {
|
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
220
|
return { date, time, datetime };
|
|
221
|
-
}
|
|
222
|
-
|
|
221
|
+
};
|
|
222
|
+
const buildLocaleFromIntl = () => {
|
|
223
223
|
if (Object.keys(bbn.dt.locales).length) {
|
|
224
224
|
return;
|
|
225
225
|
}
|
|
@@ -256,5 +256,5 @@ export default function buildLocaleFromIntl() {
|
|
|
256
256
|
time,
|
|
257
257
|
datetime
|
|
258
258
|
});
|
|
259
|
-
}
|
|
260
|
-
;
|
|
259
|
+
};
|
|
260
|
+
export { getCommonFormatsForLocale, buildLocaleFromIntl };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import parse from './parse.js';
|
|
2
|
-
import { getCommonFormatsForLocale } from './buildLocaleFromIntl.js';
|
|
2
|
+
import { getCommonFormatsForLocale, buildLocaleFromIntl } from './buildLocaleFromIntl.js';
|
|
3
3
|
// Common MySQL & native JS string formats – tried first in guessFormat
|
|
4
4
|
const MYSQL_AND_NATIVE_FORMATS = [
|
|
5
5
|
// --- MySQL / MariaDB classic ---
|
|
@@ -83,6 +83,7 @@ export default function guessFormat(input, formats, lng) {
|
|
|
83
83
|
if (!str) {
|
|
84
84
|
return null;
|
|
85
85
|
}
|
|
86
|
+
buildLocaleFromIntl();
|
|
86
87
|
const tryFormats = (fmts) => {
|
|
87
88
|
for (const fmt of fmts) {
|
|
88
89
|
// 1) Try strict format first
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import buildLocaleFromIntl from './buildLocaleFromIntl.js';
|
|
1
|
+
import { buildLocaleFromIntl } from './buildLocaleFromIntl.js';
|
|
2
2
|
import bbnDtZoned from '../classes/zoned.js';
|
|
3
3
|
import bbnDtDateTime from '../classes/dateTime.js';
|
|
4
4
|
import bbnDtDate from '../classes/date.js';
|