Nodejs Utililty Methods Day in Month

List of utility methods to do Day in Month

Description

The list of methods to do Day in Month are organized into topic(s).

Method

getDaysInMonth(year, month)
Date.getDaysInMonth = function (year, month)
    return [31, (Date.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
};
getDaysInMonthOfYear()
Date.prototype.getDaysInMonthOfYear = function(){
  month = this.getMonth();
  if(month === 1){
    return this.isLeapYear()? 29:28;
  }else{
    if(month>=8){
      return month%2? 31:30;
    }else{
      return month%2? 31:30;
...