- 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 - Locale
This method helps to get/set the duration using locale. When used with humanize, you will see the difference in output for locale() method.
Syntax
moment.duration().locale(); moment.duration().locale(String);
Example
var hi = moment.duration(1, "day").locale("hi").humanize(); var en = moment.duration(1, "minutes").locale("en").humanize(); var ja = moment.duration(1, "seconds").locale("ja").humanize(); var it = moment.duration(1, "hours").locale("it").humanize(); var marathi = moment.duration(1, "day").locale("mr").humanize(); var konkani = moment.duration(1, "day").locale("gom-latn").humanize(); var kn = moment.duration(1, "day").locale("kn").humanize();
Output
momentjs_durations.htm
Advertisements