🐛 Fix fallback behaviour for unrecognized timezones (#1241)

This commit is contained in:
Luke Vella 2024-08-04 13:27:41 +01:00 committed by GitHub
parent 7bc978b87a
commit 2798ba65ce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 63 additions and 25 deletions

View file

@ -17,10 +17,7 @@ import * as React from "react";
import { useAsync } from "react-use";
import { usePreferences } from "@/contexts/preferences";
import {
getBrowserTimeZone,
resolveGeographicTimeZone,
} from "@/utils/date-time-utils";
import { getBrowserTimeZone, normalizeTimeZone } from "@/utils/date-time-utils";
import { useRequiredContext } from "../components/use-required-context";
@ -213,7 +210,7 @@ export const DayjsProvider: React.FunctionComponent<{
const preferredTimeZone = React.useMemo(
() =>
config?.timeZone
? resolveGeographicTimeZone(config?.timeZone)
? normalizeTimeZone(config?.timeZone)
: getBrowserTimeZone(),
[config?.timeZone],
);