@bbn/bbn 2.0.52 → 2.0.54
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
|
-
export declare function getCommonFormatsForLocale(lng
|
|
27
|
+
export declare function getCommonFormatsForLocale(lng?: string | string[]): CommonFormats;
|
|
28
28
|
export default function buildLocaleFromIntl(): void;
|
|
29
29
|
export {};
|
|
@@ -125,6 +125,9 @@ const partsToPattern = (parts, resolved, requestedOpts) => {
|
|
|
125
125
|
* - Datetime: only full dates (Y-M-D ± weekday) combined with time.
|
|
126
126
|
*/
|
|
127
127
|
export function getCommonFormatsForLocale(lng) {
|
|
128
|
+
if (!lng) {
|
|
129
|
+
lng = [bbn.env.lang, ...navigator.languages];
|
|
130
|
+
}
|
|
128
131
|
const sample = new Date(Date.UTC(2000, 0, 2, 13, 45, 30));
|
|
129
132
|
const date = [];
|
|
130
133
|
const time = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function guessFormat(input: string, formats?: string | string[], lng?: string): string | null;
|
|
1
|
+
export default function guessFormat(input: string, formats?: string | string[], lng?: string | string[]): string | null;
|
|
@@ -115,11 +115,7 @@ export default function guessFormat(input, formats, lng) {
|
|
|
115
115
|
return tryFormats(list);
|
|
116
116
|
}
|
|
117
117
|
// autodetect via Intl-derived formats
|
|
118
|
-
const
|
|
119
|
-
(typeof navigator !== 'undefined'
|
|
120
|
-
? navigator.language
|
|
121
|
-
: Intl.DateTimeFormat().resolvedOptions().locale);
|
|
122
|
-
const common = getCommonFormatsForLocale(resolvedLocale);
|
|
118
|
+
const common = getCommonFormatsForLocale(lng);
|
|
123
119
|
// Avoid trivial duplicates
|
|
124
120
|
const seen = new Set();
|
|
125
121
|
const mysqlNativeCandidates = MYSQL_AND_NATIVE_FORMATS.filter(fmt => {
|