Closed yairprog closed 3 years ago
Hi, thanks for using Hebcal. This appears to be a duplicate of #65
Please note that https://github.com/hebcal/hebcal-js is no longer actively being maintained. We recommend that you use the more actively-maintained @hebcal/core
npm package.
However, you should be able to do what you're looking for with something like this
const hd = new Hebcal.HDate(20, 12, 5780); // original date
const nextMonth = new Hebcal.HDate(hd.abs() + hd.daysInMonth());
I have a significant HDate: 20, 12, 5780 [dd/mm/yyyy]. I want to get the same HDate in the next month: 20, 1, 5781 [dd/mm/yyyy].
To do that, I wrote the following code:
"let nextMonth = new Hebcal.HDate(20, 13, 5780)"
But, while it worked for me in different cases, in this case, the Hdate object I got was the 20, 12, 5780 instead of 20, 1, 5781.This bug stems from the fixMonth function (marked in bold the relevant code):
(Year 5780 is not a Leap year.)
I would really appreciate fixing this problem and/or providing another function that will allow me to get the HDate of the next month.
thanks!