MomentJS - AM/PM


Advertisements

This method helps in customizing the meridiem as per locale.

Syntax

moment.updateLocale('en', {
   meridiem : Function
});

Example

var localeData = moment.updateLocale('fr', {
   meridiem: function (hours, minutes, isLower) {
      return hours < 12 ? 'PD' : 'MD';
   }
});
var m = moment('2016-01-01T05:00:00').format('hh a');

Output

AM PM
momentjs_customization.htm
Advertisements