Closed maxthoursie closed 5 years ago
Converting a date-time to a inst doesn't respect a clock binding. It uses the system default zone instead.
(t/with-clock (t/in (t/clock) "Pacific/Honolulu") (-> (t/date-time "2019-08-07T12:00") (t/inst))) => #inst"2019-08-07T10:00:00.000-00:00"
The expected answer is 22:00
(-> (t/zoned-date-time "2019-08-07T12:00-10:00[Pacific/Honolulu]") (t/inst)) => #inst"2019-08-07T22:00:00.000-00:00"
The reverse conversion does respect the clock
(t/with-clock (t/in (t/clock) "Pacific/Honolulu") (t/zoned-date-time #inst"2019-08-07T22:00")) => #time/zoned-date-time"2019-08-07T12:00-10:00[Pacific/Honolulu]"
If you agree this is an error I'd be happy to provide a patch.
Yes, this does look like an error - I'd like to see the patch if it's fairly easy to make and discuss with @henryw374
Thanks for the patch. Now merged in.
Converting a date-time to a inst doesn't respect a clock binding. It uses the system default zone instead.
The expected answer is 22:00
The reverse conversion does respect the clock
If you agree this is an error I'd be happy to provide a patch.