mirror of
https://github.com/zulip/zulip.git
synced 2025-11-07 15:33:30 +00:00
timerender: Add fallbacks for browser time zone detection.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
9c7453c11e
commit
04a6696e33
@@ -19,6 +19,18 @@ import {user_settings} from "./user_settings";
|
||||
let next_timerender_id = 0;
|
||||
|
||||
export let display_time_zone = new Intl.DateTimeFormat().resolvedOptions().timeZone;
|
||||
if (
|
||||
display_time_zone === undefined || // https://bugs.chromium.org/p/chromium/issues/detail?id=1487920
|
||||
display_time_zone === "Etc/Unknown" // https://bugs.chromium.org/p/chromium/issues/detail?id=1473422
|
||||
) {
|
||||
display_time_zone = user_settings.timezone;
|
||||
try {
|
||||
new Intl.DateTimeFormat(undefined, {timeZone: display_time_zone});
|
||||
} catch {
|
||||
display_time_zone = "UTC";
|
||||
}
|
||||
}
|
||||
|
||||
const formatter_map = new Map<string, Intl.DateTimeFormat>();
|
||||
|
||||
export function clear_for_testing(): void {
|
||||
|
||||
Reference in New Issue
Block a user