Nodejs Month Name Get getMonthName(i)

Here you can find the source of getMonthName(i)

Method Source Code

Date.prototype.getMonthName = function(i)
{
    "use strict";
    var months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];

    if(i == months.length) 
    {//from w w w  . j a  v  a2 s .com
        i = 0;
    }

    return months[i];
};

Related

  1. getMonthName()
    Date.prototype.getMonthName = function() {
        var monthNames = ["January", "February", "March", "April", "May", "June",
        "July", "August", "Spetember", "October", "November", "December"];
        return monthNames[this.getMonth()];
    
  2. getMonthName()
    Date.prototype.getMonthName = function () {
      var map = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
      return map[this.getMonth()];
    };
    
  3. getMonthName()
    Date.prototype.getMonthName = function() {
      switch(this.getMonth()) {
        case 0:
          return 'January';
        case 1:
          return 'February';
        case 2:
          return 'March';
        case 3:
    ...
    
  4. getMonthName()
    Date.prototype.getMonthName = function () {
      var monthNames = ["January", "February", "March", "April", "May", "June",
        "July", "August", "September", "October", "November", "December"
      ];
      return monthNames[this.getMonth()];
    };
    
  5. getMonthName(abbreviation)
    "use_strict";
    function getMonthName(index, abbreviation)
        abbreviation = (typeof abbreviation === 'boolean' && abbreviation);
        var abbrs = ['Jan','Feb','Mar','Apr','May','June','July','Aug','Sept','Oct','Nov','Dec'],
            names = ['January','February','March','April','May','June','July','August','September','October','November','December'];
        return abbreviation ? abbrs[ index ] : names[ index ];
    Date.prototype.getMonthName = function(abbreviation)
    ...
    
  6. getMonthName(lang)
    Date.prototype.getMonthName = function(lang) {
        lang = lang && (lang in Date.locale) ? lang : 'en';
        return Date.locale[lang].month_names[this.getMonth()];
    };
    Date.prototype.getMonthNameShort = function(lang) {
        lang = lang && (lang in Date.locale) ? lang : 'en';
        return Date.locale[lang].month_names_short[this.getMonth()];
    };
    Date.locale = {
    ...
    
  7. getMonthName(lang)
    Date.prototype.getMonthName = function(lang) {
      lang = lang || 'sv-SE';
      return this.toLocaleString(lang, {month: 'long'});
    };
    
  8. getMonthName(lang)
    Date.prototype.getMonthName = function(lang) {
        lang = lang && (lang in Date.locale) ? lang : 'en';
        return Date.locale[lang].month_names[this.getMonth()];
    };
    Date.prototype.getMonthNameShort = function(lang) {
        lang = lang && (lang in Date.locale) ? lang : 'en';
        return Date.locale[lang].month_names_short[this.getMonth()];
    };
    Date.prototype.getDayName = function(lang) {
    ...
    
  9. getMonthName(lang)
    Date.prototype.getMonthName = function(lang) {
        lang = lang && (lang in Date.locale) ? lang : 'de';
        return Date.locale[lang].month_names[this.getMonth()];
    };
    Date.locale = {
        de: {
            month_names: ['Januar', 'Februar', 'M?', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
            month_names_short: ['Jan', 'Feb', 'M?, 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'],
            day_names: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'],
    ...