Fork me on GitHub
#juxt
<
2021-12-07
>
flowthing09:12:16

This is probably more of a cljc.java-time question, but hopefully OK to ask here: I'm looking to get the week number of a date. I'm currently doing this:

user=> (cljc.java-time.temporal.temporal/get (tick/new-date 2012 12 31) (.weekOfYear WeekFields/ISO))
53
It'd be nice not to need to import java.time.temporal.WeekFields, though. Is there a cross-platform way to do this? I couldn't find one by searching the sources.

henryw37410:12:43

hmm, yeah week fields hasnt been generated. probably can do that. googling got this, https://www.baeldung.com/java-get-week-number, which says this is alternative:

(-> (cljc.java-time.local-date/now)
    (cljc.java-time.local-date/get
       cljc.java-time.temporal.chrono-field/aligned-week-of-year))

flowthing10:12:31

Thanks! Will give that a shot.