- MomentJS Tutorial
- 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 Useful Resources
- MomentJS - Quick Guide
- MomentJS - Useful Resources
- MomentJS - Discussion
MomentJS - Checking current locale
We can check the current locale using moment.locale().
Syntax
moment.locale();
Example
moment.locale('fr'); var k = moment.locale();
Output
Example
moment.locale('fr'); var k = moment.locale(); moment.locale('ja'); var s = moment.locale();
Output
moment.locales() gives the list of all the locales available for use or which are loaded. Observe the following line of code and its output −
moment.locales()
Output
In the above example, we are using thelocale.min.js with all locales, so moment.locales() displays all the locales as shown above.
momentjs_internationalization.htm
Advertisements