mirror of
https://github.com/zulip/zulip.git
synced 2025-11-08 07:52:19 +00:00
timerender: Move display_time_zone fallback to initialize.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
8a1630ee42
commit
ec44722252
@@ -19,17 +19,6 @@ 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>();
|
||||
|
||||
@@ -341,6 +330,18 @@ let update_list: UpdateEntry[] = [];
|
||||
let last_update: Date;
|
||||
|
||||
export function initialize(): void {
|
||||
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";
|
||||
}
|
||||
}
|
||||
|
||||
last_update = start_of_day(new Date(), display_time_zone);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user