Fork me on GitHub

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


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


Have you tried a combination of between and divide?


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


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


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!

👌 4

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


count t/range