From 0b8f251a2d8f70520793b9a80ce317731d84ffc2 Mon Sep 17 00:00:00 2001 From: Harry Oosterveen Date: Fri, 14 Feb 2025 20:08:17 +0100 Subject: [PATCH] Format time using dateLocale --- src/components/hooks/useTimezone.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/hooks/useTimezone.ts b/src/components/hooks/useTimezone.ts index c74f513f..f6cf79b5 100644 --- a/src/components/hooks/useTimezone.ts +++ b/src/components/hooks/useTimezone.ts @@ -2,11 +2,13 @@ import { setItem } from 'next-basics'; import { TIMEZONE_CONFIG } from 'lib/constants'; import { formatInTimeZone, zonedTimeToUtc, utcToZonedTime } from 'date-fns-tz'; import useStore, { setTimezone } from 'store/app'; +import useLocale from './useLocale'; const selector = (state: { timezone: string }) => state.timezone; export function useTimezone() { const timezone = useStore(selector); + const { dateLocale } = useLocale(); const saveTimezone = (value: string) => { setItem(TIMEZONE_CONFIG, value); @@ -20,6 +22,7 @@ export function useTimezone() { : date.split(' ').join('T') + 'Z', timezone, pattern, + { locale: dateLocale }, ); };