thojanssens1

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):

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

Marcus

I think the data is precalculated to get faster runtime behavior. Other libraries in other languages are going the same way.
JS: https://momentjs.com/timezone/
.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

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…

Where Next?

Popular in Questions Top

dotdotdotPaul
Okay, I'm having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I'm sure I'...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
Kagamiiiii
Student & New to elixir. Nice language. I want to convert a english character, e.g. “a”, which is stored in a variable, to it’s asci...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
kostonstyle
Hi all I want to have a unix time, from the current time plus 1 hour. DateTime.now + 1 hour How to get it in elixir? Thanks
New
chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New

Other popular topics Top

JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 record...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 45766 226
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New

We're in Beta

About us Mission Statement