Long Date Formats1.1.0+

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

Locale#longDateFormat should be an object containing a key/value pair for each long date format L LL LLL LLLL LT LTS. LT should be the time format, and is also used for moment#calendar.

  1. moment.updateLocale('en', {
  2. longDateFormat : {
  3. LT: "h:mm A",
  4. LTS: "h:mm:ss A",
  5. L: "MM/DD/YYYY",
  6. l: "M/D/YYYY",
  7. LL: "MMMM Do YYYY",
  8. ll: "MMM D YYYY",
  9. LLL: "MMMM Do YYYY LT",
  10. lll: "MMM D YYYY LT",
  11. LLLL: "dddd, MMMM Do YYYY LT",
  12. llll: "ddd, MMM D YYYY LT"
  13. }
  14. });

You can eliminate the lowercase l tokens and they will be created automatically by replacing long tokens with the short token variants.

  1. moment.updateLocale('en', {
  2. longDateFormat : {
  3. LT: "h:mm A",
  4. LTS: "h:mm:ss A",
  5. L: "MM/DD/YYYY",
  6. LL: "MMMM Do YYYY",
  7. LLL: "MMMM Do YYYY LT",
  8. LLLL: "dddd, MMMM Do YYYY LT"
  9. }
  10. });