diff --git a/utils/localTimezone.ts b/utils/localTimezone.ts index f64259d..c1d29bf 100644 --- a/utils/localTimezone.ts +++ b/utils/localTimezone.ts @@ -1,6 +1,6 @@ /** * Get the name of the system timezone, and fallback to `"UTC"` if the system - * doesn't expose a timezone. + * doesn't expose a named timezone. * * This is useful for setting the initial value of an HTML input where the user * enters their timezone, or in a UI where the user has no option of selecting a @@ -9,5 +9,6 @@ * @category Timezones */ export function localTimezone(): string { - return Intl.DateTimeFormat()?.resolvedOptions()?.timeZone || "UTC"; + const tz = Intl.DateTimeFormat()?.resolvedOptions()?.timeZone; + return tz?.includes("/") ? tz : "UTC"; }