- MomentJS - Home
- MomentJS - Overview
- MomentJS - Environment Setup
- MomentJS - Introduction
- MomentJS - Parsing Date And Time
- MomentJS - Date Validation
- MomentJS - Getter/Setter
- Manipulate Date And Time
- Formatting Date And Time
- MomentJS - Date Queries
- MomentJS - Internationalization
- MomentJS - Customization
- MomentJS - Durations
- MomentJS - Utilities
- MomentJS - Plugins
- MomentJS - Examples
MomentJS - Long Date Formats
This method helps in customizing longdateformat for a locale.
Syntax
moment.updateLocale('en', {
longDateFormat : Object
});
Here longDateFormat is an object containing key / value pair for each format.
Example
var localeData = moment.updateLocale('fr', {
longDateFormat: {
LT: "h:mm",
LTS: "h:mm:ss A",
L: "MM/DD/YYYY",
l: "M/D/YYYY",
LL: "MMMM Do YYYY",
ll: "MMM D YYYY",
LLL: "MMMM Do YYYY LT",
lll: "MMM D YYYY LT",
LLLL: "dddd, MMMM Do YYYY LT",
llll: "ddd, MMM D YYYY LT"
}
});
var m = moment().format('LT');
var x = moment().format('LLLL');
Output
momentjs_customization.htm
Advertisements