MomentJS - Internationalization


Internationalization is one of the important features in MomentJS. You can display Date and Time based on localization, in other words, based on the country/region. The locale can be applied to specific moment if required.

This chapter discusses in detail about how to make apply locale globally, locally, work with locale using Node.js, in browser, get the units (months, weekdays etc.) in the required locale etc.

Sr.No. Locale & Description
1 Global locale

We can assign locale globally and all the date /time details will be available in the locale assigned.

2 Changing Locale Locally

We need locale to applied locally in case we need to handle many locales in an application.

3 Using Locale in Browser

We can start working with locale by including the locale file in script tag.

4 Using Locale using Node.js

If you happen to use Node.js , you will have the locale files already in moment when you do npm install moment.

5 momentjs_Listing date/time details of current locale

You can set the locale and check the details like months, weekdays etc.

6 Checking current locale

We can check the current locale using moment.locale().

7 Accessing Locale Specific Functionality

Here will see the methods and properties available on currently loaded locale.