Skip to content

Commit

Permalink
Make sure nice-date-time also match the more local locale
Browse files Browse the repository at this point in the history
  • Loading branch information
cheeaun committed Aug 21, 2024
1 parent c542286 commit cea06f3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/utils/nice-date-time.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit cea06f3

Please sign in to comment.