Skip to content

Commit 96ec303

Browse files
authored
Updated if condition for Leap year detection
1 parent d8395e7 commit 96ec303

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

Timing-Functions/GetMonthDays.js

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

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

3026
return 28
3127
}

0 commit comments

Comments
 (0)