When an invalid date is passed to the constructor of HDate(), normally it is handled by calling fix(date), which will either increment or decrement the month to return a valid date. For example, new HDate(30, 2, 5784) will roll over and return HDate {month: 3, day: 1, year: 5784}.
This does not work for Adar in a non leap year, so a call to new HDate(30, 12, 5783) will not return HDate {month: 1, day: 1, year: 5783}
as I expected, rather HDate {month: 12, day: 1, year: 5783}.
This is because of this line of code increments the month to 13, and then this next function decrements it back to 12.
A fix for this would be to replace date.mm += 1;in here with
When an invalid date is passed to the constructor of HDate(), normally it is handled by calling
fix(date)
, which will either increment or decrement the month to return a valid date. For example,new HDate(30, 2, 5784)
will roll over and returnHDate {month: 3, day: 1, year: 5784}
.This does not work for Adar in a non leap year, so a call to
new HDate(30, 12, 5783)
will not returnHDate {month: 1, day: 1, year: 5783}
as I expected, ratherHDate {month: 12, day: 1, year: 5783}
.This is because of this line of code increments the month to 13, and then this next function decrements it back to 12.
A fix for this would be to replace
date.mm += 1;
in here withI don't want to open a PR, because I was unable to test locally.