Make sure nice-date-time also match the more local locale

This commit is contained in:
Lim Chee Aun 2024-08-22 00:10:48 +08:00
parent c54228627c
commit cea06f32fc

View file

@ -1,12 +1,16 @@
import { i18n } from '@lingui/core';
import localeMatch from './locale-match';
import mem from './mem';
const defaultLocale = new Intl.DateTimeFormat().resolvedOptions().locale;
const _DateTimeFormat = (opts) => {
const { locale, dateYear, hideTime, formatOpts } = opts || {};
const loc = locale && !/pseudo/i.test(locale) ? locale : defaultLocale;
const loc =
locale && !/pseudo/i.test(locale)
? localeMatch([locale], [defaultLocale])
: defaultLocale;
const currentYear = new Date().getFullYear();
const options = {
// Show year if not current year