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 localeWe can assign locale globally and all the date /time details will be available in the locale assigned. |
2 | Changing Locale LocallyWe need locale to applied locally in case we need to handle many locales in an application. |
3 | Using Locale in BrowserWe can start working with locale by including the locale file in script tag. |
4 | Using Locale using Node.jsIf 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 localeYou can set the locale and check the details like months, weekdays etc. |
6 | Checking current localeWe can check the current locale using moment.locale(). |
7 | Accessing Locale Specific FunctionalityHere will see the methods and properties available on currently loaded locale. |
Leave a Reply