🐛 Fix locale for calendar and clock (#1330)

This commit is contained in:
Tagaishi
2023-09-01 17:13:55 +02:00
committed by GitHub
parent 3b74f735a1
commit 981c964ba9
3 changed files with 13 additions and 12 deletions

View File

@@ -3,7 +3,6 @@ import { Calendar } from '@mantine/dates';
import { IconCalendarTime } from '@tabler/icons-react';
import { useSession } from 'next-auth/react';
import { useState } from 'react';
import { useRouter } from 'next/router';
import { getLanguageByCode } from '~/tools/language';
import { RouterOutputs, api } from '~/utils/api';
@@ -64,7 +63,6 @@ interface CalendarTileProps {
}
function CalendarTile({ widget }: CalendarTileProps) {
const { locale } = useRouter();
const { colorScheme, radius } = useMantineTheme();
const { name: configName } = useConfigContext();
const [month, setMonth] = useState(new Date());
@@ -74,8 +72,7 @@ function CalendarTile({ widget }: CalendarTileProps) {
enabled: !!sessionData?.user,
});
const language = getLanguageByCode(locale ?? 'en');
require(`dayjs/locale/${language.locale}.js`);
const language = getLanguageByCode(userWithSettings?.settings.language ?? 'en');
const { data: medias } = api.calendar.medias.useQuery(
{