function daysInMonth(month, year) {
  return new Date(year, month + 1, 0).getDate();
}
Get total days number in a month.
because we're using 0 as the day so that it returns the last day
of the last month, so you have to add 1 to the month number
so it returns the correct amount of days.
https://stackoverflow.com/questions/1184334/get-number-days-in-a-specified-month-using-javascript
@param month 0-based
@param year
@returns {number}