MomentJS - 星期缩写



此方法有助于根据所设置的语言环境自定义星期缩写。

语法

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

示例

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

输出

Abbreviation

示例

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());

输出

Abbreviation Weekday
momentjs_customization.htm
广告