juxt

Joe 2020-06-10T12:29:33.162400Z

Hi! I'm using juxt/tick and I want to know how many days are in a period P2M . At a higher level, I'm looking to calculate the fraction of a year a period represents, if that's simpler. Thanks

Joe 2020-06-10T12:34:40.163Z

I tried days but that's obviously not what it's for.

Joe 2020-06-10T13:03:49.163100Z

I should specify that I do start out with two dates to generate the period - thinking about it, you can't say exactly how many days are in a month. So I guess what I'm actually looking for is the number of days between two dates

Johanna 2020-06-10T13:16:03.163400Z

Have you tried a combination of between and divide?

Johanna 2020-06-10T13:16:13.163600Z

(tick/divide (tick/between <some instant> <some other instant>)
	         (tick/new-duration 1 :days))

Johanna 2020-06-10T13:17:34.163800Z

This would work for durations (between gives a duration) but not for periods, for the reasons you've just given.

dominicm 2020-06-10T13:23:57.167Z

count t/range

Joe 2020-06-10T13:24:37.167700Z

I did have a look at divide - but as you say I was using periods and I was getting some thing like ‘doesn’t work on estimates’. It sounds like converting the dates I was using to instants before calling between would solve that. I’ll give it a go, thanks!

👌 1
Joe 2020-06-10T13:28:07.167900Z

Thanks!