Update GetMonthDays.js

This commit is contained in:
Rak Laptudirm
2021-01-23 16:07:09 +05:30
committed by GitHub
parent 5120fd37c6
commit 7c3b0adcca

View File

@ -21,7 +21,11 @@ const getMonthDays = (monthNumber, year) => {
if (the30DaysMonths.includes(monthNumber)) { return 30 }
// Check for Leap year
if (((year % 400) === 0) || (((year % 100) !== 0) && ((year % 4) === 0))) { return 29 }
if (year % 4 === 0) {
if ((year % 100 !== 0) || (year % 100 === 0 && year % 400 === 0)) {
return 29
}
}
return 28
}