-
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
Possible edge case around last rule applicable for a zone lines last year #137
Comments
Hey @lau Have confirmed the issue in comparison to browser implementations. E.g. ls = [
"2011-12-30T09:00:00Z",
"2011-12-30T09:59:00Z",
"2011-12-30T10:00:00Z",
"2011-12-30T10:59:00Z",
"2011-12-30T11:00:00Z"
]
ls.map(x => [x, new Intl.DateTimeFormat('sv-SE', {
timeZone: 'Pacific/Apia',
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
hour12: false,
timeZoneName: 'short'
}).format(new Date(x))]) returns
Current tzdata implementation [
"2011-12-30T09:00:00Z",
"2011-12-30T09:59:00Z",
"2011-12-30T10:00:00Z",
"2011-12-30T10:59:00Z",
"2011-12-30T11:00:00Z"
]
|> Enum.map(&Timex.parse!(&1, "{ISO:Extended:Z}"))
|> Enum.map(&{&1, Timex.Timezone.convert(&1, "Pacific/Apia")}) returns [
{~U[2011-12-30 09:00:00Z], #DateTime<2011-12-30 23:00:00+14:00 +14 Pacific/Apia>},
{~U[2011-12-30 09:59:00Z], #DateTime<2011-12-30 23:59:00+14:00 +14 Pacific/Apia>},
{~U[2011-12-30 10:00:00Z], #DateTime<2011-12-31 00:00:00+14:00 +14 Pacific/Apia>},
{~U[2011-12-30 10:59:00Z], #DateTime<2011-12-31 00:59:00+14:00 +14 Pacific/Apia>},
{~U[2011-12-30 11:00:00Z], #DateTime<2011-12-31 01:00:00+14:00 +14 Pacific/Apia>}
]
|
@ciju FYI you may also test and add edge cases here: https://github.com/mathieuprog/tzdb_test which compares the output of date calculations against different time zone libraries. I think tzdata still generates a lot of incorrect dates and these tests would help you fix tzdata errors. |
Didn't know about tz. Guess I will just move to tz for my purpose. Hope tzdata issues are fixed soon, or Timex moves to tz/better options :) |
Timex can be replaced by the standard API (which evolved significantly since Timex released). I thought you were tied to Timex and had to fix the tzdata bug:) |
Noticed the edge case for Pacific/Apia timezone. This timezone has a shift in offset of about a day in dec 2011. There are also DST rules applicable for the same year. Following are the relevant zone lines.
Current implementation ignores the offset change on dec 29th. E.g. The periods generated are:
I think the periods should be.
Link to the zone rules for Pacific/Apia
Haven't checked if this issue applies to any other zones.
The text was updated successfully, but these errors were encountered: