我在我的项目和格式化日期中使用Moment.js如下:
var locale = window.navigator.userLanguage || window.navigator.language;
moment.locale(locale);
someDate.format("L");
Run Code Online (Sandbox Code Playgroud)
它运作良好但有时我需要显示没有年份的日期.我不能使用类似的东西,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'
Run Code Online (Sandbox Code Playgroud)