You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm getting a strange effect from dateFromFields when hour is set to 0. The doc says “Hours are input in 24 hour time range 0 to 23 valid. Returns dates in current time zone.” But watch this:
import Date.Extra.Format exposing (..)
import Date exposing (..)
import Date.Extra.Create exposing (..)
d = dateFromFields 2016 Jul 8 0 0 0 0
isoString d -- "2016-07-08T01:00:00.000-0400" : String
hour d -- 1 : Int
My time zone is indeed -0400:
> (new Date()).getTimezoneOffset()
240
but it's turning hour zero into hour 1. It does that all the way up the clock:
So I can provide hour 23 to get zero, but it's the next day. I also tried -1, but it clamps it to 1.
The offset issue reminds me of what's discussed in #6, but it looks like the solution there has to do with the syntax of the offset when parsing. Here I'm bypassing any parsing and trying to construct a date directly.
The text was updated successfully, but these errors were encountered:
Wow that is weird.
I ran up my notebook in timezone -03:30 - it happens to be a time zone I have got some other tests in and it exhibits the same behavior you demonstrate.
Thanks for the report.
I believe I have fixed this.
I have published 7.2.1.
It was related to timezone offset of the date being created compared to the the timezone offset of epoch date (which is 1970-01-01 used internally).
I'm getting a strange effect from
dateFromFields
when hour is set to0
. The doc says “Hours are input in 24 hour time range 0 to 23 valid. Returns dates in current time zone.” But watch this:My time zone is indeed
-0400
:but it's turning hour zero into hour 1. It does that all the way up the clock:
So I can provide hour
23
to get zero, but it's the next day. I also tried-1
, but it clamps it to1
.The offset issue reminds me of what's discussed in #6, but it looks like the solution there has to do with the syntax of the offset when parsing. Here I'm bypassing any parsing and trying to construct a date directly.
The text was updated successfully, but these errors were encountered: