Fix locale matching

This commit is contained in:
Lim Chee Aun 2024-08-22 19:24:45 +08:00
parent 36f0e7a0c5
commit 9b2c01fb02
2 changed files with 2 additions and 2 deletions

View file

@ -16,7 +16,7 @@ function isValidDate(value) {
const resolvedLocale = new Intl.DateTimeFormat().resolvedOptions().locale;
const DTF = mem((locale, opts = {}) => {
const lang = localeMatch([locale], [resolvedLocale]);
const lang = localeMatch([locale], [resolvedLocale], locale);
try {
return new Intl.DateTimeFormat(lang, opts);
} catch (e) {}

View file

@ -9,7 +9,7 @@ const _DateTimeFormat = (opts) => {
const { locale, dateYear, hideTime, formatOpts } = opts || {};
const loc =
locale && !/pseudo/i.test(locale)
? localeMatch([locale], [defaultLocale])
? localeMatch([locale], [defaultLocale], locale)
: defaultLocale;
const currentYear = new Date().getFullYear();
const options = {