juxt

2021-03-31T19:51:13.009300Z

Tick question: How to I translate the following clojure.java-time code to tick?

(let [year 2020
        month 12
        day 1
        count 5]
    (take count (jtime/iterate jtime/plus
                               (jtime/local-date year month day)
                               (jtime/days 1))))


(#time/date "2020-12-01"
 #time/date "2020-12-02"
 #time/date "2020-12-03"
 #time/date "2020-12-04"
 #time/date "2020-12-05")

2021-03-31T19:52:01.010100Z

The iterate part. "seq interval" ??

dominicm 2021-03-31T19:54:36.010300Z

@dcj there's a (t/range) function you might need?

2021-03-31T19:54:52.010600Z

ok, looking !

2021-03-31T19:56:26.011100Z

@dominicm that's it, thank you!

dominicm 2021-03-31T19:57:11.011200Z

@dcj looks like jtime/iterate is a convenience function, so you can just use clojure.core/iterate like so: (iterate #(t/+ % (t/new-durations 1 :days))) too.

dominicm 2021-03-31T19:57:23.011300Z

But I think range is better for some reason I forget :)

2021-03-31T20:17:07.011700Z

(let [year 2020
        month 12
        day 1
        num-days 5
        start (t/new-date year month day)
        end   (t/+ start (t/new-period num-days :days))
        ]
    (t/range start
             end
             (t/new-period 1 :days)))
Thanks!