Skip to content

Commit 7c3b0ad

Browse files
authored
Update GetMonthDays.js
1 parent 5120fd3 commit 7c3b0ad

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Timing-Functions/GetMonthDays.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ const getMonthDays = (monthNumber, year) => {
2121
if (the30DaysMonths.includes(monthNumber)) { return 30 }
2222

2323
// Check for Leap year
24-
if (((year % 400) === 0) || (((year % 100) !== 0) && ((year % 4) === 0))) { return 29 }
24+
if (year % 4 === 0) {
25+
if ((year % 100 !== 0) || (year % 100 === 0 && year % 400 === 0)) {
26+
return 29
27+
}
28+
}
2529

2630
return 28
2731
}

0 commit comments

Comments
 (0)