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")
The iterate
part. "seq interval" ??
@dcj there's a (t/range)
function you might need?
ok, looking !
@dominicm that's it, thank you!
@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.
But I think range is better for some reason I forget :)
(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!