create-plume-react-project
Version:
CLI to create Plume React Project
18 lines (16 loc) • 592 B
text/typescript
import 'dayjs/locale/fr';
import 'dayjs/locale/en';
import localizedFormat from 'dayjs/plugin/localizedFormat';
import dayjs from 'dayjs';
import LocaleService from '../locale/LocaleService';
import { Locale } from '@lib/locale-resolver/LocaleResolver';
/**
* Gère le chargement des traductions pour dayjs
*/
export default function initializeLocalizedDate(localeService: LocaleService) {
dayjs.extend(localizedFormat);
dayjs.locale(localeService.getCurrentLocale().get().code);
localeService
.getCurrentLocale()
.subscribe((locale: Locale) => dayjs.locale(locale.code));
}