@bbn/bbn 2.0.90 → 2.0.92
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/classes/dt.js +1 -1
- package/dist/dt/functions/buildLocaleFromIntl.d.ts +1 -28
- package/dist/dt/functions/buildLocaleFromIntl.js +1 -1
- package/dist/dt/functions/guessFormat.js +4 -6
- package/dist/dt/functions/parse.js +1 -1
- package/package.json +1 -1
package/dist/dt/classes/dt.js
CHANGED
|
@@ -229,7 +229,7 @@ export class bbnDt {
|
|
|
229
229
|
throw new TypeError('Cannot compare different Temporal or bbnDt types');
|
|
230
230
|
}
|
|
231
231
|
static parse(input, format, cls = 'auto', locale) {
|
|
232
|
-
return
|
|
232
|
+
return bbn.dt(input, format, cls, locale);
|
|
233
233
|
}
|
|
234
234
|
parse(input, format) {
|
|
235
235
|
return bbnDt.parse(input, format, camelToCss(this.kind));
|
|
@@ -1,29 +1,2 @@
|
|
|
1
|
-
type CommonFormats = {
|
|
2
|
-
date: Array<{
|
|
3
|
-
pattern: string;
|
|
4
|
-
sample: string;
|
|
5
|
-
options: Intl.DateTimeFormatOptions;
|
|
6
|
-
}>;
|
|
7
|
-
time: Array<{
|
|
8
|
-
pattern: string;
|
|
9
|
-
sample: string;
|
|
10
|
-
options: Intl.DateTimeFormatOptions;
|
|
11
|
-
}>;
|
|
12
|
-
datetime: Array<{
|
|
13
|
-
pattern: string;
|
|
14
|
-
sample: string;
|
|
15
|
-
options: Intl.DateTimeFormatOptions;
|
|
16
|
-
}>;
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Get a curated set of *common* date, time and datetime formats
|
|
20
|
-
* for the given locale, without exploding into thousands of combos.
|
|
21
|
-
*
|
|
22
|
-
* Rules:
|
|
23
|
-
* - Date: only sensible combos (Y-M-D ± weekday, Y-M, M-D).
|
|
24
|
-
* - Time: hour / hour:minute / hour:minute:second (+ optional TZ).
|
|
25
|
-
* - Datetime: only full dates (Y-M-D ± weekday) combined with time.
|
|
26
|
-
*/
|
|
27
|
-
declare const getCommonFormatsForLocale: (lng?: string | string[]) => CommonFormats;
|
|
28
1
|
declare const buildLocaleFromIntl: () => void;
|
|
29
|
-
export
|
|
2
|
+
export default buildLocaleFromIntl;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import parse from './parse.js';
|
|
2
|
-
import
|
|
2
|
+
import 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 ---
|
|
@@ -54,8 +54,6 @@ export default function guessFormat(input, formats, lng) {
|
|
|
54
54
|
const list = Array.isArray(formats) ? formats : [formats];
|
|
55
55
|
return tryFormats(list);
|
|
56
56
|
}
|
|
57
|
-
// autodetect via Intl-derived formats
|
|
58
|
-
const common = getCommonFormatsForLocale(lng);
|
|
59
57
|
// Avoid trivial duplicates
|
|
60
58
|
const seen = new Set();
|
|
61
59
|
const mysqlNativeCandidates = MYSQL_AND_NATIVE_FORMATS.filter(fmt => {
|
|
@@ -65,9 +63,9 @@ export default function guessFormat(input, formats, lng) {
|
|
|
65
63
|
return true;
|
|
66
64
|
});
|
|
67
65
|
const localeCandidates = [
|
|
68
|
-
...
|
|
69
|
-
...
|
|
70
|
-
...
|
|
66
|
+
...bbn.dt.locales.datetime.map(f => f.pattern),
|
|
67
|
+
...bbn.dt.locales.date.map(f => f.pattern),
|
|
68
|
+
...bbn.dt.locales.time.map(f => f.pattern)
|
|
71
69
|
].filter(fmt => {
|
|
72
70
|
if (seen.has(fmt))
|
|
73
71
|
return false;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
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';
|