- 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 - Normalize Units
This method allows to normalize the units used in your program. Note that the methods which makes use of units, such as moment().get(‘h’) or moment().get(‘hours’) are same.
In case you want to define the alias for units, you can do so using the Normalize method. Using the year as y or YEar or yEARs will fallback to year using normalizeUnits.
Syntax
moment.normalizeUnits(String);
Example
moment.normalizeUnits('y'); moment.normalizeUnits('Y'); moment.normalizeUnits('yEar'); moment.normalizeUnits('yeArs'); moment.normalizeUnits('YeARS');
Output
Example
var m = moment.normalizeUnits('M'); var a = moment.normalizeUnits('MONTHS'); var b = moment.normalizeUnits('Months'); var c = moment.normalizeUnits('MonTh');
Output
momentjs_utilities.htm
Advertisements