Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

timezone: Use canonical zone names #3278

Merged
merged 5 commits into from
Sep 26, 2023
Merged

timezone: Use canonical zone names #3278

merged 5 commits into from
Sep 26, 2023

Conversation

mastercactapus
Copy link
Member

Description:
This PR adds the list of time zones, aliases, and posix-strings to the timezone package.

The LoadLocation utility will now map zones to their canonical name, and return an error before calling time.LoadLocation if the zone is unknown.

Which issue(s) this PR fixes:
Fixes #38

Describe any introduced user-facing changes:

  • Aliases like US/Central will no longer appear in the time zone dropdown/search
  • API calls using aliases like US/Central will still work, but be automatically mapped to America/Chicago (as an example)
  • Existing schedules/rotations will behave the same, but in the UI they will always refer to the canonical name (US/Central in the DB will appear as America/Chicago in UI)
  • Posix strings like CST6CDT will continue to work and be allowed via API for compatibility but will not appear in the timezone dropdown. These are not aliases and can not be mapped to a zone.
  • No changes to stored data are made with this update, however, the next time a rotation/schedule is updated, the canonical name will be stored instead (if it was previously an alias).

Additional Info:
Previously the list of timezones was driven by the database rather than reflecting the actual list of supported zones by GoAlert. Since all time calculations are done in-app, this poses an issue as the list of actually supported zones could differ from what is available for users to select.

This change resolves that issue by using a fixed list to go along with the fixed tzdata in a GoAlert binary.

Co-authored-by: Nathaniel Cook <[email protected]>
@mastercactapus mastercactapus merged commit 49ad199 into master Sep 26, 2023
@mastercactapus mastercactapus deleted the canonical-zones branch September 26, 2023 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rotations: Deprecated timezone leading to text rendering issues
3 participants