AM/PM Parsing2.1.0+
// From 2.12.0 onward
moment.updateLocale('en', {
meridiemParse : RegExp
isPM : Function
});
// From 2.8.1 to 2.11.2
moment.locale('en', {
meridiemParse : RegExp
isPM : Function
});
// Deprecated in 2.8.1
moment.lang('en', {
meridiemParse : RegExp
isPM : Function
});
Locale#isPM
should return true if the input string is past 12 noon. This is used in parsing the a A
tokens.
moment.updateLocale('en', {
isPM : function (input) {
return ((input + '').toLowerCase()[0] === 'p');
}
});
To configure what strings should be parsed as input, set the meridiemParse
property.
moment.updateLocale('en', {
meridiemParse : /[ap]\.?m?\.?/i
});
当前内容版权归 momentjs.com 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 momentjs.com .