diff --git a/packages/react/src/components/Forms/DatePicker/Calendar.tsx b/packages/react/src/components/Forms/DatePicker/Calendar.tsx index 66d2cb9..b099997 100644 --- a/packages/react/src/components/Forms/DatePicker/Calendar.tsx +++ b/packages/react/src/components/Forms/DatePicker/Calendar.tsx @@ -6,7 +6,11 @@ import { GregorianCalendar, toCalendar, } from "@internationalized/date"; -import { useDateFormatter, useLocale } from "@react-aria/i18n"; +import { + DateFormatterOptions, + useDateFormatter, + useLocale, +} from "@react-aria/i18n"; import { useCalendarState } from "@react-stately/calendar"; import { useCalendar } from "@react-aria/calendar"; import { @@ -82,33 +86,29 @@ export const Calendar = ({ ...props }: CalendarSubProps) => { const { locale } = useLocale(); + const { t } = useCunningham(); + const ref = useRef(null); const state = useCalendarState({ ...props, locale, createCalendar, }); - - const ref = useRef(null); const { calendarProps, prevButtonProps, nextButtonProps } = useCalendar( props, state ); - const monthItemsFormatter = useDateFormatter({ - month: "long", - timeZone: state.timeZone, - }); + const useTimeZoneFormatter = (formatOptions: DateFormatterOptions) => { + return useDateFormatter({ + ...formatOptions, + timeZone: state.timeZone, + }); + }; - const selectedMonthItemFormatter = useDateFormatter({ - month: "short", - timeZone: state.timeZone, - }); - - const yearItemsFormatter = useDateFormatter({ - year: "numeric", - timeZone: state.timeZone, - }); + const monthItemsFormatter = useTimeZoneFormatter({ month: "long" }); + const selectedMonthItemFormatter = useTimeZoneFormatter({ month: "short" }); + const yearItemsFormatter = useTimeZoneFormatter({ year: "numeric" }); const monthItems: Array