Created
January 22, 2020 11:59
-
-
Save 19Site/82c280912c7d5751b80ed6265eb21561 to your computer and use it in GitHub Desktop.
Get days of month
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* get last date of month | |
*/ | |
function getDaysOfMonth(year, month) { | |
// get date by month | |
switch (month) { | |
case 2: | |
return isLeapYear(year) ? 29 : 28; | |
case 4: | |
case 6: | |
case 9: | |
case 11: | |
return 30; | |
default: | |
return 31; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment