Skip to content

Commit b88ef9e

Browse files
committed
fix: wrong days for hw4 leap year
1 parent bb5fb3d commit b88ef9e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

hw4/src/calculator.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ class Calculator {
3434
// ignore 0 index
3535
let daysIn = [0, 31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
3636
if (this.#isLeapYear(year))
37-
daysIn[2] = 28;
38-
else
3937
daysIn[2] = 29;
38+
else
39+
daysIn[2] = 28;
4040

4141
numDays = day2 + (daysIn[month1] - day1);
4242

0 commit comments

Comments
 (0)