Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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).

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Thanks,

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

“|end.add(duration(day:1))“`

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading