Nodejs Month Calculate isSameMonth(d)

Here you can find the source of isSameMonth(d)

Method Source Code

Date.prototype.isSameMonth = function (d) {
    var tDate = new Date(this.getFullYear(), this.getMonth(), this.getDate());
    var pDate = new Date(d.getFullYear(), d.getMonth(), d.getDate());
    return tDate.getMonth() == pDate.getMonth() 
}

Related

  1. getShortMonth()
    Date.prototype.getShortMonth = function () {
       return ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"][this.getMonth()];
    };
    
  2. getShortMonthName()
    Date.prototype.getShortMonthName = function () {
      var monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
        "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
      ];
      return monthNames[this.getMonth()];
    };
    
  3. incrementMonth( iIncrementValue )
    var aMonths = [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ]
    var aDays = [ 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' ]
    Date.prototype.incrementMonth = function ( iIncrementValue )
      this.setMonth(
        this.getMonth() + iIncrementValue
      )
    Date.prototype.toDayString = function ()
    ...
    
  4. isAfterMonth(d)
    Date.prototype.isAfterMonth = function (d) {
        var tDate = new Date(this.getFullYear(), this.getMonth(), this.getDate());
        var pDate = new Date(d.getFullYear(), d.getMonth(), d.getDate());
        if(tDate.getFullYear() < pDate.getFullYear()) return false;
        if(tDate.getMonth() < pDate.getMonth()) return false;
        return true;
    
  5. isBeforeMonth(d)
    Date.prototype.isBeforeMonth = function (d) {
        var tDate = new Date(this.getFullYear(), this.getMonth(), this.getDate());
        var pDate = new Date(d.getFullYear(), d.getMonth(), d.getDate());
        if(tDate.getFullYear() > pDate.getFullYear()) return false;
        if(tDate.getMonth() > pDate.getMonth()) return false;
        return true;
    
  6. isSameMonth(d)
    Date.prototype.isSameMonth = function(d){
        var tDate = new Date(this.getFullYear(), this.getMonth(), this.getDate());
        var pDate = new Date(d.getFullYear(), d.getMonth(), d.getDate());
        if(tDate.getFullYear() != pDate.getFullYear()) return false;
        if(tDate.getMonth() != pDate.getMonth()) return false;
        return true;
    
  7. month()
    Date.prototype.month = function()
      var months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
      return months[this.getMonth()];
    
  8. monthAbbrev[ "Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec" ];
    Date.prototype.monthAbbrev = [ "Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec" ];
    Date.prototype.monthFull = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ];
    Date.prototype.weekAbbrev = [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
    Date.prototype.weekFull = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
    Date.prototype.format = function(format)
      var output = format;
      output = output.replace("uHH",this.getUTCHours().toString().padLeft("0",2));
      output = output.replace("HH",this.getHours().toString().padLeft("0",2));
    ...
    
  9. monthName(language)
    Date.prototype.monthName = function(language) {
      var monthName = "";
      language = language || 'en';
      switch(language.toLowerCase()) 
        case 'en':
          monthName = ['January','February','March','April','May','June','July', 'August','September','October','November','December'];
          break;
        case 'es':
    ...