2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-11-13 19:36:46 +00:00

Fix locale formatting for calendar display (#10418) (#10420)

- Cannot accept underscore

(cherry picked from commit bcc386aecf)

Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
This commit is contained in:
github-actions[bot]
2025-09-29 11:31:49 +10:00
committed by GitHub
parent 542a75ce58
commit 9c170e6ed3

View File

@@ -27,7 +27,7 @@ import {
IconDownload,
IconFilter
} from '@tabler/icons-react';
import { useCallback, useEffect, useState } from 'react';
import { useCallback, useEffect, useMemo, useState } from 'react';
import { useShallow } from 'zustand/react/shallow';
import type { CalendarState } from '../../hooks/UseCalendar';
import { useLocalState } from '../../states/LocalState';
@@ -59,6 +59,9 @@ export default function Calendar({
const [locale] = useLocalState(useShallow((s) => [s.language]));
// Ensure underscore is replaced with dash
const calendarLocale = useMemo(() => locale.replace('_', '-'), [locale]);
const selectMonth = useCallback(
(date: DateValue) => {
state.selectMonth(date);
@@ -186,7 +189,7 @@ export default function Calendar({
plugins={[dayGridPlugin, interactionPlugin]}
initialView='dayGridMonth'
locales={allLocales}
locale={locale}
locale={calendarLocale}
headerToolbar={false}
footerToolbar={false}
{...calendarProps}