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

Alert user if they use a "winter timezone abbreviation" during summer. #103

Open
dcastro opened this issue Sep 6, 2023 · 0 comments
Open
Milestone

Comments

@dcastro
Copy link
Member

dcastro commented Sep 6, 2023

Clarification and motivation

If, in August, a user says "10am WET", it's very likely they meant to say "10am WEST" instead, since no timezone in the world observes the WET offset at that time of the year.

We should tell the user about this, and suggest they edit their message to WEST.
Something along the lines of:

No timezone observes the WET offset (UTC +0) on 1 August 2023. Did you mean to say "WEST" instead? If so, please edit your message.

We should do the same for other timezone abbreviation pairs, like PST/PDT, EST/EDT, etc.

Caveats

Unidirectional pairs

The BST offset is observed during summer in Europe/London, Europe/Guernsey, Europe/Isle_of_Man and Europe/Jersey.

According to https://www.timeanddate.com/time/zones/bst, all of these timezones observe GMT during winter, so it's reasonable to suggest the user edits their message to GMT during winter.

However, the opposite is not true. If a user says "GMT" during summer, it's not at all reasonable to suggest they edit their message to "BST". In this case, we should not emit a warning at all.

Year-round offsets

The CET/CEST pair is an odd one (though there may be more like it).
During summer, almost all timezones change their offset to CEST, except:

  • Africa/Algiers: This timezone has not observed DST changes since 1980, and currently sticks to CET year-round.
  • Africa/Tunis: This timezone has not observed DST changes since 2008, and currently sticks to CET year-round.

So, should we or should we not tell the user anything if they say "CET" during summer?

I think we should. According to https://www.timeanddate.com/time/zones/cet, there are 31 countries that change CET -> CEST during summer and only 2 that don't, so it's highly likely the user meant to say CEST, though not guaranteed.

We should adjust the message's phrasing accordingly, e.g. instead of saying "No timezones ..." we could say "Most timezones ...".

Implementation

It's currently not clear where/how to obtain the information about how many timezones in the world observe a given timezone abbreviation at a given moment in time.

At a quick glance, the tzdata package seems to have enough information for this: https://hackage.haskell.org/package/tzdata-0.2.20230322.0/docs/src/Data.Time.Zones.DB.html#tzDescriptions

PS: Note that timezone abbreviations with the same offset are NOT equivalent. Both WET and GMT have the offset UTC+0, but they should not be treated similarly.

@dcastro dcastro added this to the v1.1 milestone Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant