-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
handle variable timezone offsets in dates due daylight saving #86
Conversation
Thank you for your PR. |
Yes, It can be (In fact, I do this as a quick fix). But I thought I it would be better to make a fix for it, since I expected that the |
I understand the reason. Thank you. |
Sure, done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Hi @abalazsik, I have another question. The |
Hmm, I'm not familiar with daylight saving, but the following behavior feels strange: %% Call the function during the summer
> jsone:encode({{2024, 9, 18}, {3,0,0}}, [{datetime_format,{iso8601,local_dst}}]).
<<"\"2024-09-18T03:00:00+02:00\"">>
%% Call the function during the winter
%% => The input value remains the same, but the output differs
> jsone:encode({{2024, 9, 18}, {3,0,0}}, [{datetime_format,{iso8601,local_dst}}]).
<<"\"2024-09-18T03:00:00+01:00\"">> I think that if there is a time adjustment between However, if the current behavior is not causing any trouble to you, it is okay to keep the current |
The wikipedia article about ISO 8601 says this: "The standard provides a well-defined, unambiguous method of representing calendar dates and times in worldwide communications, especially to avoid misinterpreting numeric dates and times when such data is transferred between countries with different conventions for writing numeric dates and times" It is an extra data for the consumer, so it can transform the date to its timezone. It does not make sense to send the timezone of timestamp value. The example might feel strange, but it shows that the timezone calculation is not a "pure function", it depends on the current timezone. |
I see. Thank you. |
Anytime :-) |
Hi! I've noticed that in the JSON responses of my server the timezones are off by 1 hour in the summer months. After digging a little bit, I found out that this library assumes that all timezone offsets are constant during the year. But it is not true in many countries.
I'm in the Europe/Budapest timezone. We use the UTC + 1 during winter, and UTC + 2 timezone during the summer due the daylight saving procedure.
Here is a little fix that calculates the current zone offset based on the current time. I implemented it as a new datetime_format so it will not break any existing code.