AM/PM Parsing2.1.0+

  1. // From 2.12.0 onward
  2. moment.updateLocale('en', {
  3. meridiemParse : RegExp
  4. isPM : Function
  5. });
  6. // From 2.8.1 to 2.11.2
  7. moment.locale('en', {
  8. meridiemParse : RegExp
  9. isPM : Function
  10. });
  11. // Deprecated in 2.8.1
  12. moment.lang('en', {
  13. meridiemParse : RegExp
  14. isPM : Function
  15. });

Locale#isPM should return true if the input string is past 12 noon. This is used in parsing the a A tokens.

  1. moment.updateLocale('en', {
  2. isPM : function (input) {
  3. return ((input + '').toLowerCase()[0] === 'p');
  4. }
  5. });

To configure what strings should be parsed as input, set the meridiemParse property.

  1. moment.updateLocale('en', {
  2. meridiemParse : /[ap]\.?m?\.?/i
  3. });