thojanssens1
Why does tzdata generates periods based on the tz iana rules?
Correct me if I’m wrong: the tzdata library seems to generate a huge number of periods based on tz iana zone rules.
You can see the module attribute in the first few lines of this module which seems to indicate that (and all the calc_periods functions):
https://github.com/lau/tzdata/blob/master/lib/tzdata/period_builder.ex#L1
So maybe really dumb question: why isn’t it possible to simply use the rules in order to have the correct local date?
For example, in Belgium, 28th January 2030, at 16:30 UTC will be 17:30 local time (gmt+1) according to the iana tz rule data.
Not sure what’s going on. Any idea?
Marked As Solved
Marcus
I think the data is precalculated to get faster runtime behavior. Other libraries in other languages are going the same way.
JS: Moment Timezone | Home
.NET: https://nodatime.org/tzvalidate/generate?version=2019c
The calculation for time zone states is not so simple as it looks at first sight. There are many edge cases and some strange rules in the IANA rule set.
You can compute dates in the future. But it is not guaranteed that this will be the correct date forever. The rules can change over time.
Also Liked
NobbZ
You can’t know yet. During the next year europe will get rid of DST. And only at the end of 2020, we will know if a state stays in “summer” or “winter” time.
Also, Belgium might perhaps to decide to leave EU until then and joins the Peoples Republic of China and join their timezone… Unlikely, but who knows?
The actual timezone is only known for events in the past.
I’m pretty sure someone else in this forum might be able to explain in more detail…
There has been a lot of discussion in the threads about introducing the time related modules Calendar, NaiveDateTime, Time, Date, etc…
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #hex










