Skip to content

Commit

Permalink
fixing moment locale
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasheartcliff committed Feb 26, 2024
1 parent f13eaab commit ee315f4
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,13 @@ export function mapLocaleToMoment(i18nLocale: string | undefined) {
}

export async function setLocale(locale?: string) {
const momentLocale = mapLocaleToMoment(locale);
const momentLocale = mapLocaleToMoment(locale) as string;
if (!locale || locale === 'en') {
moment.locale(locale);
} else {
let l =(await import(`moment/locale/${momentLocale}`)).default;
l=l
const localeData =(await import(`moment/locale/${momentLocale}`)).default;
// Set the locale for Moment.js
// moment.updateLocale(momentLocale, localeData);
moment.updateLocale(momentLocale, localeData);
moment.locale(momentLocale);
}
}

0 comments on commit ee315f4

Please sign in to comment.