🐛 Fixed locale on Calendar + moment to dayjs

This commit is contained in:
Tagaishi
2023-08-13 21:47:50 +02:00
parent 8130504430
commit b62b6b9ee7
6 changed files with 63 additions and 69 deletions

View File

@@ -8,7 +8,9 @@ import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
import { PersistQueryClientProvider } from '@tanstack/react-query-persist-client';
import Consola from 'consola';
import { getCookie } from 'cookies-next';
import moment from 'moment-timezone';
import dayjs from 'dayjs';
import locale from 'dayjs/plugin/localeData'
import utc from 'dayjs/plugin/utc'
import { GetServerSidePropsContext } from 'next';
import { appWithTranslation } from 'next-i18next';
import { AppProps } from 'next/app';
@@ -39,6 +41,9 @@ import {
} from '../tools/server/getPackageVersion';
import { theme } from '../tools/server/theme/theme';
dayjs.extend(locale);
dayjs.extend(utc);
function App(
this: any,
props: AppProps<{
@@ -54,8 +59,8 @@ function App(
const { Component, pageProps } = props;
// TODO: make mapping from our locales to moment locales
const language = getLanguageByCode(pageProps.locale);
require('moment/locale/' + language.momentLocale);
moment.locale(language.momentLocale);
require(`dayjs/locale/${language.locale}.js`);
dayjs.locale(language.locale);
const [primaryColor, setPrimaryColor] = useState<MantineTheme['primaryColor']>(
props.pageProps.config?.settings.customization.colors.primary || 'red'