MomentJS - Weekday Abbreviation


Advertisements

This method helps in customizing the weekday abbreviations based on the locale set.

Syntax

moment.updateLocale('en', {
   weekdaysShort : String[]
});
moment.updateLocale('en', {
   weekdaysShort : Function
});

Example

var localeData = moment.updateLocale('en', {
   weekdaysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
});
var m = localeData.weekdaysShort();

Output

Abbreviation

Example

var localeData = moment.updateLocale('en', {
   weekdaysShortarr: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
   weekdaysShort: function (momentToFormat, format) {
      return this._weekdaysShortarr[momentToFormat.day()];
   }
});
var m = localeData.weekdaysShort(moment());

Output

Abbreviation Weekday
momentjs_customization.htm
Advertisements