mirror of
https://github.com/zulip/zulip.git
synced 2025-11-08 16:01:58 +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;
|
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>();
|
||||||
|
|
||||||
export function clear_for_testing(): void {
|
export function clear_for_testing(): void {
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ export type UserSettings = (StreamNotificationSettings &
|
|||||||
send_read_receipts: boolean;
|
send_read_receipts: boolean;
|
||||||
automatically_follow_topics_policy: number;
|
automatically_follow_topics_policy: number;
|
||||||
automatically_unmute_topics_in_muted_streams_policy: number;
|
automatically_unmute_topics_in_muted_streams_policy: number;
|
||||||
|
timezone: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export let user_settings: UserSettings;
|
export let user_settings: UserSettings;
|
||||||
|
|||||||
Reference in New Issue
Block a user