Clarification and motivation
At the moment, we're using Data.Time.TZInfo.fromLabel to fetch the timezone rules for some given timezone.
|
eithTzInfo :: Either UnknownTimeZoneAbbrev TZI.TZInfo |
|
eithTzInfo = case timeRef.trLocationRef of |
|
Nothing -> pure $ TZI.fromLabel sendersTZLabel |
|
Just (TimeZoneRef tzLabel) -> pure $ TZI.fromLabel tzLabel |
|
Just (OffsetRef offset) -> pure $ tzInfoFromOffset offset |
|
Just (TimeZoneAbbreviationRef abbrev) -> pure $ tzInfoFromOffset $ abbrev.tzaiOffsetMinutes |
|
Just (UnknownTimeZoneAbbreviationRef unknownAbbrev) -> Left unknownAbbrev |
However, as the haddocks state, this uses the IANA database embedded inside the tzdata package:

Timezone rules are constantly getting updated and, unless we constantly upgrade the tzdata dependency to the latest version, eventually we'll be using old timezone rules, leading to wrong conversions.
Instead, we should use the operating system's timezone database, using Data.Time.TZInfo.loadFromSystem.
Note:
- Let's first check with the SRE team whether the server indeed contains this database, and that it is updated regularly.
loadFromSystem will not work on Windows. We should document that the server cannot run on Windows.
- (we could workaround this by defaulting to using
fromLabel on windows, but if there's no need to support windows, then it's not worth doing)
Clarification and motivation
At the moment, we're using
Data.Time.TZInfo.fromLabelto fetch the timezone rules for some given timezone.tzbot/src/TzBot/TimeReference.hs
Lines 140 to 146 in 4c2315e
However, as the haddocks state, this uses the IANA database embedded inside the
tzdatapackage:Timezone rules are constantly getting updated and, unless we constantly upgrade the
tzdatadependency to the latest version, eventually we'll be using old timezone rules, leading to wrong conversions.Instead, we should use the operating system's timezone database, using
Data.Time.TZInfo.loadFromSystem.Note:
loadFromSystemwill not work on Windows. We should document that the server cannot run on Windows.fromLabelon windows, but if there's no need to support windows, then it's not worth doing)