Calendar1.3.0+
// From 2.12.0 onward
moment.updateLocale('en', {
calendar : Object
});
// From 2.8.1 to 2.11.2
moment.locale('en', {
calendar : Object
});
// Deprecated in 2.8.1
moment.lang('en', {
calendar : Object
});
Locale#calendar
should have the following formatting strings.
moment.locale('en', {
calendar : {
lastDay : '[Yesterday at] LT',
sameDay : '[Today at] LT',
nextDay : '[Tomorrow at] LT',
lastWeek : '[last] dddd [at] LT',
nextWeek : 'dddd [at] LT',
sameElse : 'L'
}
});
Each of the Locale#calendar
keys can also be a callback function with thescope of the current moment and first argument a moment that depicts now. Itshould return a formatting string.
function callback (now) {
return '[hoy a la' + ((this.hours() !== 1) ? 's' : '') + '] LT';
}
当前内容版权归 momentjs.com 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 momentjs.com .