> The second problem is the fact that the timezone definitions change according to the actual rules in effect in history. This is sometimes not what you want. Indeed I notice that sometimes all date libraries use the proleptic Gregorian calendar meaning our current calendar system extended backwards; no library that I know of automatically switches to Julian calendars before the cutoff. Why this inconsistency? I’d argue that when most humans express a zoned time they expect the current rules to be extended backwards. People forget the daylight saving rules change in the 2000s when talking about times before that change and expect the current rules.
Good question. One part of this answer is that the IANA tzdb does not only contain daylight saving time transitions. It also includes transitions from one offset to another, perhaps because daylight saving time was stopped or started. The other part of this answer is, I would guess, more pragmatic. Namely, we have structured data delineating time zone transitions back at least a century. If you go far enough back, then indeed, time zone transitions stop happening. We, however, do not, as far as I'm aware, have shared structured data delineating changes in calendar. This would also need to be organized by both location and time. For example, the Julian calendar was not dropped in favor of the Gregorian instantaneously everywhere. Some countries, like Russia, continued using the Julian calendar into the 20th century.
An other fun one is that some of the transition schemes were... imaginative, let's say. Famously Sweden didn't want a hard break so in 1699 they decided that they would just skip leap days until they were on Gregorian. So they skipped the one in 1700, then promptly forgot the 1704 and 1708 ones because they were busy with the Great Northern War, as a result the scheme was cancelled by reverting to the Julian calendar, which they did by adding a second leap day in 1712 (which thus had a February 30th, and 367 days). Sweden ended up doing the switch at once in 1753.
That's calendaring rather than timezoning tho. Timezones really only became a factor once timekeeping was precise enough and times had to be communicated and synchronised across vast distances, which really came about with the railways (first formal "time zone" was the Railway Time of England's Great Western Railway). Before that, cities and villages oft had their individual time based on apparent solar time at the location (aka a sundial). For instance Paris Mean Time was 9 minutes and 21 seconds ahead of London.
While not necessarily wrong, it should probably be a separate library entirely: there are projects maintaining GIS boundaries for the IANA timezones.
I found the icu::TimeZoneNames class. The docstring even describes my exact problem:
> For example, people in the United States refer the zone used by the east part of North America as "Eastern Time". The tz database contains multiple time zones "America/New_York", "America/Detroit", "America/Montreal" and some others that belong to "Eastern Time". However, assigning different display names to these time zones does not make much sense for most of people.
I then looked at the icu::TimeZoneNames::find member function and it seemed to do exactly what I proposed. https://unicode-org.github.io/icu-docs/apidoc/dev/icu4c/clas... Except it’s marked as internal use only. I don’t know what’s going on.