Fork me on GitHub
#juxt
<
2022-10-03
>
Nikolas Pafitis11:10:56

I got a question on juxt/tick. I'm pretty familiar with js-joda (and java time). I'm using tick in the frontend where i get a js-joda LocalDate back from a datepicker component, and I want to convert it to a native inst. If i try t/inst I get an exception like this:

No protocol method IConversion.inst defined for type object: 2022-10-03
The type is LocalDate , presumably from js-joda. Now I could use the js-joda approach by doing .atStartofDay to get a LocalDateTime and then convert that to an instant, but what would be the pure tick approach?

henryw37412:10:03

there isn't a pure tick approach for that afaik. I'd drop to calling atstartofday, using the fn via https://github.com/henryw374/cljc.java-time to be sure it works cross platform. and I'd call the 2-arg version to be explicit about the zone - see https://github.com/juxt/tick#instants. once you have zoneddatetime from that, you can call t/instant to get the end result

1