Open espinielli opened 4 years ago
Just from reading its README, it looks like this repos has code for it... https://github.com/graphhopper/timezone
This is a great idea, but I don't think I'll be able to look at it any time very soon, and in fact I'm not sure how possible it is... I don't know if maps for historical time zones exist (https://github.com/evansiroky/timezone-boundary-builder uses open street map for the boundaries).
Hello, I'm the maintainer of timezone-boundary-builder. I don't believe that you need different versions of geographic data to accomplish this. Each timezone identifier already comes with a history of time changes that have occurred. Take for example Asia/Famagusta
which decided to stop observing daylight savings, but then reinstated it a year later. When the group of people who decided to deviate from the rest of Cyprus timekeeping methods, a new timezone identifier was created in the timezone database project here: https://github.com/eggert/tz/blob/c6c18a432298874f2fdd4ad90df90d615f5846fa/asia#L1174-L1178
Therefore, any datetime library that correctly interprets these time changes in each timezone should be able to correctly produce local times at any historical datetime as far back as the year 1970 at which point the maintainers of the timezone database don't bother trying to recreate correct time before then.
The only problem I could see is if some people at various airports decided that they actually use a different timekeeping method (different timezone name) than what the legally expected or the current best guess of the boundaries from community input into the timezone-boundary-builder project. Another possible problem is a library that uses timezone-boundary-builder data may not have updated to the latest version of timezone-boundary-builder data.
My doubt with lutz
's API is that in order to get the correct TZ you need two arguments:
Yes, the TZDB copes with all the historical changes and I am happy to see that timezone-boundary-builder does it too.
In my initial description of the issue, I was in fact pointing out that the second argument could have a default of now
but also any other past timestamp.
As you hinted, it looks like all the building blocks are available...I'll see whether I would be able to propose something sensible...
I see you you're after now - if you're not talking about time zone boundaries actually moving, just changing over time, I think this is doable. Thanks for chiming in @evansiroky - and thanks for providing the timezone boundaries!
@espinielli for testing, would you be able to provide me with at least one location at which the TZ has changed, and the dates it was changed?
From Wikipedia's Time Zone:
Russia is traditionally divided into 11 time zones, but in 2011 the number was reduced to nine. Then-President Dmitry Medvedev said at the time that he would like to see even fewer in place.[16] Still, in 2014, the two removed time zones were reinstated, making the number of time zones 11 again.
[16] "About Time: Huge country, nine time zones" (Video). BBC. March 22, 2011. Retrieved February 12, 2019.
Searching further: https://www.timeanddate.com/news/time/russia-may-cut-time-zones.html
I have a need to transform UTC timestamps to local datetimes for different locations (airports) in the world and from dates going back till for example 2004.
luts
from what I understand would only returns the relevant timezones of a geographical location as defined today (i.e. the latest tzdb version at the time the package has been created), while in the past years things could have been differently defined.The
tzdb
from IANA [1] has the data for the different historical definitions.I was wondering whether lutz could be extended to cope with the above need or if you are aware of other packages doing it (google a little bit but found nothing.)
Any feedback is highly appreciated.
[1] https://www.iana.org/time-zones