mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-06 01:18:23 +08:00
Merge branch 'master' of https://github.com/raklaptudirm/Javascript
This commit is contained in:
@ -57,6 +57,7 @@
|
||||
* [CoinChange](https://github.com/TheAlgorithms/Javascript/blob/master/Dynamic-Programming/CoinChange.js)
|
||||
* [EditDistance](https://github.com/TheAlgorithms/Javascript/blob/master/Dynamic-Programming/EditDistance.js)
|
||||
* [FibonacciNumber](https://github.com/TheAlgorithms/Javascript/blob/master/Dynamic-Programming/FibonacciNumber.js)
|
||||
* [findMonthCalendar](https://github.com/TheAlgorithms/Javascript/blob/master/Dynamic-Programming/findMonthCalendar.js)
|
||||
* [KadaneAlgo](https://github.com/TheAlgorithms/Javascript/blob/master/Dynamic-Programming/KadaneAlgo.js)
|
||||
* [LevenshteinDistance](https://github.com/TheAlgorithms/Javascript/blob/master/Dynamic-Programming/LevenshteinDistance.js)
|
||||
* [LongestCommonSubsequence](https://github.com/TheAlgorithms/Javascript/blob/master/Dynamic-Programming/LongestCommonSubsequence.js)
|
||||
|
@ -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