Skip to content

Instantly share code, notes, and snippets.

@19Site
Created January 22, 2020 11:59
Show Gist options
  • Save 19Site/82c280912c7d5751b80ed6265eb21561 to your computer and use it in GitHub Desktop.
Save 19Site/82c280912c7d5751b80ed6265eb21561 to your computer and use it in GitHub Desktop.
Get days of month
/**
* 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