English 中文(简体)
MomentJS - Internationalization
  • 时间:2024-11-03

MomentJS - Internationapzation


Previous Page Next Page  

Internationapzation is one of the important features in MomentJS. You can display Date and Time based on locapzation, in other words, based on the country/region. The locale can be appped 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 appped locally in case we need to handle many locales in an apppcation.

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 pke months, weekdays etc.

6 Checking current locale

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

7 Accessing Locale Specific Functionapty

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

Advertisements