Bug 698496: Handle leap years correctly in the Date constructor.

InLeapYear expects the parameter to be a timestamp and not a year.
Use DaysInYear instead.

Thanks to Robert Rosendahl for spotting this.
This commit is contained in:
Tor Andersson
2020-01-10 11:16:14 +01:00
parent 8ee595bee7
commit fe71080c59

View File

@@ -217,7 +217,7 @@ static double MakeDay(double y, double m, double date)
return NAN;
yd = floor(TimeFromYear(y) / msPerDay);
md = firstDayOfMonth[InLeapYear(y)][im];
md = firstDayOfMonth[DaysInYear(y) == 366][im];
return yd + md + date - 1;
}