Skip to content

Why does DST affect addition/subtraction? #1639

Answered by diesieben07
alex996 asked this question in Q&A
Discussion options

You must be logged in to vote

Logically, "now" is the same moment of time in every time zone (in JS, same number of milliseconds since the epoch), and in 200 days from now, it'll still be the same moment everywhere.

This is unfortunately not true, because days are not the same length everywhere due to DST changes. In the long run obviously they are, because DST "adds" an hour once a year and "removes" an hour once a year, but DST is observed at different times in the year.

Taking your example, when you add 200 days from now, Asia/Bangkok will not have observed DST, but on 2024-11-03 at 02 am America/New_York will set the clocks back by 1 hour. As such, the "200 days" will take one hour longer to complete in America/…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@alex996
Comment options

@diesieben07
Comment options

Answer selected by alex996
@alex996
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants