mirror of
https://github.com/umami-software/umami.git
synced 2025-12-06 01:18:00 +01:00
Format time using dateLocale
This commit is contained in:
parent
e34547cf2d
commit
0b8f251a2d
1 changed files with 3 additions and 0 deletions
|
|
@ -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 },
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue