MomentJS - AM/PM Parsing


Advertisements

You can parse AM/PM using this method.

Syntax

moment.updateLocale('en', {
   meridiemParse : RegExp
   isPM : Function // will return true or false.
});

Example

var localeData = moment.updateLocale('fr', {
   meridiemParse: /PD|MD/,
   isPM: function (input) {
      return input.charAt(0) === 'M';
   }
});
var m = localeData.isPM("MD");

Output

isPM
momentjs_customization.htm
Advertisements