Fork me on GitHub
#juxt
<
2023-12-13
>
msuess15:12:54

In tick, since date is a local date w/o timezone info and and Instant doesn't have timezone info either, why does it have to pass the Instant through zoned-date-time first? This manifested in a bug for me where I had a "Jan 01 00:00:00" instant and passed it to date, resulting in "Dec 31" while my timezone was set to Honolulu (in cljs)

henryw37415:12:10

hello. firstly, this isnt a tick issue - but a java.time one. and it does trip people up... so much so that it is only one of 3 top tips in the readme: https://github.com/juxt/tick?tab=readme-ov-file#instants.

msuess15:12:18

t/zone of instant is hard coded to "UTC". I my case I expected it to use that when going from instant to local-date instead of (current-zone) but I guess that is highly subjective and dependent on the problem. I would argue though that it's less of an issue in java.time because it doesn't allow you to go from Instant to LocalDate without explicitly passing a Zone.

msuess15:12:24

Thank you for your answers and the links, I will study the the java.time API documentation some more!

henryw37416:12:28

yeah true. I think if doing it over I would probably not have anything using current-zone - but it has been like that since the start of tick and too late to change now

👍 1
msuess16:12:41

It’s definitely a source of side effects that I didn’t think about until now 😄

henryw37416:12:51

well yeah the ambient clock , providing both the now and where info, in use for example when you call (t/date)and so on is hardly textbook functional programming.