mirror of
https://github.com/cheeaun/phanpy.git
synced 2024-11-21 16:55:25 +03:00
Make sure nice-date-time also match the more local locale
This commit is contained in:
parent
c54228627c
commit
cea06f32fc
1 changed files with 5 additions and 1 deletions
|
@ -1,12 +1,16 @@
|
||||||
import { i18n } from '@lingui/core';
|
import { i18n } from '@lingui/core';
|
||||||
|
|
||||||
|
import localeMatch from './locale-match';
|
||||||
import mem from './mem';
|
import mem from './mem';
|
||||||
|
|
||||||
const defaultLocale = new Intl.DateTimeFormat().resolvedOptions().locale;
|
const defaultLocale = new Intl.DateTimeFormat().resolvedOptions().locale;
|
||||||
|
|
||||||
const _DateTimeFormat = (opts) => {
|
const _DateTimeFormat = (opts) => {
|
||||||
const { locale, dateYear, hideTime, formatOpts } = 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 currentYear = new Date().getFullYear();
|
||||||
const options = {
|
const options = {
|
||||||
// Show year if not current year
|
// Show year if not current year
|
||||||
|
|
Loading…
Reference in a new issue