- MomentJS 教程
- MomentJS - 主頁
- MomentJS - 概述
- MomentJS - 環境設定
- MomentJS - 簡介
- MomentJS - 解析日期和時間
- MomentJS - 日期驗證
- MomentJS - 獲取器/設定器
- 操作日期和時間
- 格式化日期和時間
- MomentJS - 日期查詢
- MomentJS - 國際化
- MomentJS - 自定義
- MomentJS - 時段
- MomentJS - 實用工具
- MomentJS - 外掛
- MomentJS - 示例
- MomentJS 有用資源
- MomentJS - 速查指南
- MomentJS - 有用資源
- MomentJS - 討論
MomentJS - 標準化單位
此方法允許標準化程式中使用的單位。請注意,使用單位的方法,例如 moment().get(‘h’) 或 moment().get('hours') 相同。
如果想定義單位的別名,可以使用“Normalize”方法。使用“y”或“YEar”或“yEARs”代替年,normalizeUnits 會回退到“年”。
語法
moment.normalizeUnits(String);
示例
moment.normalizeUnits('y');
moment.normalizeUnits('Y');
moment.normalizeUnits('yEar');
moment.normalizeUnits('yeArs');
moment.normalizeUnits('YeARS');
輸出
示例
var m = moment.normalizeUnits('M');
var a = moment.normalizeUnits('MONTHS');
var b = moment.normalizeUnits('Months');
var c = moment.normalizeUnits('MonTh');
輸出
momentjs_utilities.htm
廣告