case 4739 - browser that can't name its time zone: its own offset instead of New York

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-31 16:58:27 -07:00
parent 0aaf5a2ca6
commit 1188829841

View File

@@ -37,7 +37,7 @@ export default {
// Get users default time zone
// first check if overriden in useroptions
// if not then use browsers own setting
// if that is empty then final default of "America/New_York"
// if the browser can't name its time zone then its current offset from UTC
//https://www.iana.org/time-zones
//https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
getResolvedTimeZoneName() {
@@ -49,7 +49,14 @@ export default {
if (!window.$gz.util.stringIsNullOrEmpty(tz)) {
return tz;
} else {
return "America/New_York";
//case 4739: e.g. a new Windows time zone the browser doesn't know yet; this used to be "America/New_York"
//a fixed offset zone in whole hours, the only kind every browser and luxon accept by name
//(Etc/GMT signs are reversed: UTC-7 is Etc/GMT+7, which is what getTimezoneOffset returns, 420 minutes)
const hours = Math.round(new Date().getTimezoneOffset() / 60);
if (hours == 0) {
return "Etc/GMT";
}
return `Etc/GMT${hours > 0 ? "+" : "-"}${Math.abs(hours)}`;
}
}
},