【发布时间】:2015-02-06 05:35:28
【问题描述】:
我在我的项目中使用 Moment.js 并将日期格式化如下:
var locale = window.navigator.userLanguage || window.navigator.language;
moment.locale(locale);
someDate.format("L");
效果很好,但有时我需要显示一个没有年份的日期。我不能使用像someDate.format("MM/DD") 这样的东西,因为在某些语言中它应该是someDate.format("DD/MM")。我需要类似L,LL,LLL 但没有年份的东西。
我能做什么?
LTS : 'h:mm:ss A',
LT : 'h:mm A',
L : 'MM/DD/YYYY',
LL : 'MMMM D, YYYY',
LLL : 'MMMM D, YYYY LT',
LLLL : 'dddd, MMMM D, YYYY LT'
【问题讨论】:
标签: javascript localization locale momentjs