juxt

flowthing 2021-12-07T09:51:16.012200Z

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.

2021-12-07T10:03:43.012300Z

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))

flowthing 2021-12-07T10:04:31.012900Z

Thanks! Will give that a shot.

2021-12-07T10:05:38.013100Z

👍