mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-06 01:18:23 +08:00
Update GetMonthDays.js
This commit is contained in:
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user