diff --git a/src/api/locale.js b/src/api/locale.js index 72f58ed..6d39784 100644 --- a/src/api/locale.js +++ b/src/api/locale.js @@ -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)}`; } } },