Nodejs Month Calculate getAbbrMonth()

Here you can find the source of getAbbrMonth()

Method Source Code

Date.prototype.getAbbrMonth = function() {
  switch(this.getMonth()) {
    case 0: return 'Jan';
    case 1: return 'Feb';
    case 2: return 'March';
    case 3: return 'Apr';
    case 4: return 'May';
    case 5: return 'Jun';
    case 6: return 'July';
    case 7: return 'Aug';
    case 8: return 'Sept';
    case 9: return 'Oct';
    case 10: return 'Nov';
    case 11: return 'Dec';
  }/*from w  w w  .j  a v  a 2 s  . co  m*/
};

Related

  1. beginning_of_month()
    Date.prototype.beginning_of_month = function() {
      return new Date(this.getFullYear(), this.getMonth(), 1);
    
  2. countDaysMonth()
    Date.prototype.countDaysMonth = function () {
        var monthStart = new Date(this);
        var monthEnd = new Date(this);
        monthEnd.setMonth(monthEnd.getMonth() + 1);
        var qtdeDias = Math.round((monthEnd - monthStart) / (1000 * 60 * 60 * 24));
        return qtdeDias
    };
    
  3. end_of_month()
    Date.prototype.end_of_month = function() {
      var month = this.getMonth() + 1;
      var year = this.getFullYear();
      if (month > 11) {
        month = 0;
        year++;
      return new Date(year, month, 0);
    
  4. getCurrentMonthDays()
    Date.prototype.getCurrentMonthDays = function(){
            var thisTime = this.getTime();
            if(this.getMonth() == 11){
                this.setYear(this.getYear()+1);
                this.setMonth(0);
            else{
                this.setMonth(this.getMonth()+1);
            var currentDays = parseInt((this.getTime()-thisTime)/1000/60/60/24);
            this.setTime(thisTime);
            return currentDays; 
    
  5. getFirstDayOfMonth()
    Date.prototype.getFirstDayOfMonth = function () {
        var day = (this.getDay() - (this.getDate() - 1)) % 7;
        return (day < 0) ? (day + 7) : day;
    
  6. getLastDateInMonth(months)
    Date.prototype.getLastDateInMonth = function (months){
      months = parseInt(months);
      return new Date(this.getFullYear(), this.getMonth() + (months || 0) + 1, 0);
    
  7. getLastDayOfMonth()
    Date.prototype.getLastDayOfMonth = function () {
        var day = (this.getDay() + (Date.daysInMonth[this.getMonth()] - this.getDate())) % 7;
        return (day < 0) ? (day + 7) : day;