Repository navigation
Fix: Show the current UTC offset in the timezone setting - #773
Merged
Merged
Conversation
The labels from timezones-list have a fixed offset per zone, so they are wrong while daylight saving is in effect and when a region changes its rules (America/Edmonton is listed as GMT-07:00 but has been UTC-6 year-round since November 2026). Build the offset from the browser's Intl data for the current date instead, keeping the static label as a fallback for zones the browser does not know.
Owner
|
Thank you |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The timezone select in Settings → Web UI uses the labels from
timezones-list, which have one fixed offset per zone. That label is wrong for half the year in every zone with daylight saving (e.g.America/Torontois always shown as GMT-05:00, also in summer), and it goes stale when a region changes its rules:America/Edmontonis listed as GMT-07:00, but Alberta has stayed on UTC-6 year-round since November 2026 (tzdata 2026f).The selected value was already right (it is the IANA name, and the default comes from the browser); only the text was misleading.
Change
server/ui-src/utils/timezones.js: builds each label from the browser's own timezone data for the current date (Intl.DateTimeFormatwithtimeZoneName: "longOffset"), e.g.America/Edmonton (GMT-06:00). If the browser does not know a zone, the originaltimezones-listlabel is kept.AppSettings.vueuses these labels; the option values (tzCode) are unchanged.timezones.test.js(DST on/off, UTC, half-hour offset, unknown zone, fallback).Testing
npm test(46 passing),npm run lint,npm run package.