Skip to content
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

Zone transitions should take effect on their start times #7

Open
justinmimbs opened this issue Sep 14, 2018 · 2 comments · May be fixed by #34
Open

Zone transitions should take effect on their start times #7

justinmimbs opened this issue Sep 14, 2018 · 2 comments · May be fixed by #34

Comments

@justinmimbs
Copy link

justinmimbs commented Sep 14, 2018

For Posix times on the minute of a Zone transition's start time, an older offset is used for the local adjustment, instead of the new offset as expected.

The offset search looks for a transition time < the POSIX time, but it should look for one <= the POSIX time.

Here's an SSCCE, where the custom zone transitions at 2:00 UTC to the offset +01, so the local clocks would read 3:00 at that time.

import Time

transition =
    { start = 2 * 60, offset = 60 }

Time.toHour
    (Time.customZone 0 [ transition ])
    (Time.millisToPosix (transition.start * 60000))
    == 2
    
-- expected 3

Also, here's an Ellie that makes the example a little more visual.

@gyzerok
Copy link

gyzerok commented Sep 17, 2018

[ ( "01:59", start - 1 )
, ( "03:00", start )
, ( "03:01", start + 1 )
]

It looks like you have a mistake in your Ellie, because 03:00 - 1 /= 1:59, but rather 02:59. Am I missing something?

@justinmimbs
Copy link
Author

Here is more info about the expected clock times for those three minutes:

UTC   | America/New_York
----- | ---------------------------------------
06:59 | 01:59 Eastern Standard Time (UTC-05:00)
07:00 | 03:00 Eastern Daylight Time (UTC-04:00)
07:01 | 03:01 Eastern Daylight Time (UTC-04:00)

The issue in elm/time is that, for the minute of any transition time (like the middle line above), it chooses the previous offset instead of the new offset (returning 02:00 instead of 03:00 in this example). Perhaps adding zone names would improve the Ellie example: https://ellie-app.com/3ncbw7mzg25a1

pd9333 added a commit to pd9333/elm-time2 that referenced this issue Jul 22, 2022
Note that we subtract 1 minute from starting point of each era as a workaround before
elm/time#7 is fixed.
pd9333 added a commit to pd9333/elm-time2 that referenced this issue Jul 22, 2022
Note that we subtract 1 minute from starting point of each era as a workaround before
elm/time#7 is fixed.
pd9333 added a commit to pd9333/elm-time2 that referenced this issue Jul 22, 2022
Note that we subtract 1 minute from starting point of each era as a workaround before
elm/time#7 is fixed.
pd9333 added a commit to pd9333/elm-time2 that referenced this issue Jul 22, 2022
Note that we subtract 1 minute from starting point of each era as a workaround before
elm/time#7 is fixed.
pd9333 added a commit to pd9333/elm-time2 that referenced this issue Jul 22, 2022
Note that we subtract 1 minute from starting point of each era as a workaround before
elm/time#7 is fixed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants