mirror of https://github.com/zulip/zulip.git
timerender: Move display_time_zone fallback to initialize.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
8a1630ee42
commit
ec44722252
|
@ -19,17 +19,6 @@ import {user_settings} from "./user_settings";
|
||||||
let next_timerender_id = 0;
|
let next_timerender_id = 0;
|
||||||
|
|
||||||
export let display_time_zone = new Intl.DateTimeFormat().resolvedOptions().timeZone;
|
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>();
|
const formatter_map = new Map<string, Intl.DateTimeFormat>();
|
||||||
|
|
||||||
|
@ -341,6 +330,18 @@ let update_list: UpdateEntry[] = [];
|
||||||
let last_update: Date;
|
let last_update: Date;
|
||||||
|
|
||||||
export function initialize(): void {
|
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);
|
last_update = start_of_day(new Date(), display_time_zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -494,6 +494,7 @@ export function initialize_everything() {
|
||||||
}
|
}
|
||||||
|
|
||||||
i18n.initialize(i18n_params);
|
i18n.initialize(i18n_params);
|
||||||
|
timerender.initialize();
|
||||||
widgets.initialize();
|
widgets.initialize();
|
||||||
tippyjs.initialize();
|
tippyjs.initialize();
|
||||||
compose_tooltips.initialize();
|
compose_tooltips.initialize();
|
||||||
|
@ -609,7 +610,6 @@ export function initialize_everything() {
|
||||||
copy_and_paste.initialize();
|
copy_and_paste.initialize();
|
||||||
overlays.initialize();
|
overlays.initialize();
|
||||||
invite.initialize();
|
invite.initialize();
|
||||||
timerender.initialize();
|
|
||||||
message_view_header.initialize();
|
message_view_header.initialize();
|
||||||
server_events.initialize();
|
server_events.initialize();
|
||||||
user_status.initialize(user_status_params);
|
user_status.initialize(user_status_params);
|
||||||
|
|
Loading…
Reference in New Issue