Created
March 5, 2018 13:49
-
-
Save nicolascb/39dbc448ea48ad061c0b50e4e68ec1eb to your computer and use it in GitHub Desktop.
JavaScript = Count days of month
This file contains hidden or 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
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