Skip to content

Instantly share code, notes, and snippets.

@nicolascb
Created March 5, 2018 13:49
Show Gist options
  • Save nicolascb/39dbc448ea48ad061c0b50e4e68ec1eb to your computer and use it in GitHub Desktop.
Save nicolascb/39dbc448ea48ad061c0b50e4e68ec1eb to your computer and use it in GitHub Desktop.
JavaScript = Count days of month
var getDaysInMonth = function(month,year) {
// Here January is 1 based
// //Day 0 is the last day in the previous month
return new Date(year, month, 0).getDate();
// // Here January is 0 based
// // return new Date(year, month+1, 0).getDate();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment