Jiffy difference in month

I use Jiffy for calculate the difference in between 2 date in month.
But I don’t the good result.

For end = 2/4/2023 and start = 1/4/2022 I have 12 months.

For end = 1/4/2023 and start = 1/4/2022 I have 11 months (error: expected 12).


num month = Jiffy(end).diff(Jiffy(start), Units.MONTH);

>Solution :

Right now it is checking 12 at midnight to 12 at midnight of the end date which is 11 months 30 days. Now if the end date is one second greater than the correct date it should work. So a hackey solution is to add one day duration to the end date and check


Leave a Reply