【发布时间】:2019-06-14 05:41:06
【问题描述】:
我们是否有像 moment.weekdays() 或 moment.months() 这样的函数,它会返回 AM PM 本地化? moment.period() 之类的东西?
timeFormatDefaultLocale({
"dateTime": "%A, der %e. %B %Y, %X",
"date": "%d.%m.%Y",
"time": "%H:%M:%S",
"periods": ["AM", "PM"], <------ I need to pass moment function to get period
"days": moment.weekdays() as any,
"shortDays": moment.weekdaysShort() as any,
"months": moment.months() as any,
"shortMonths": moment.monthsShort() as any
});
【问题讨论】:
-
这会有所帮助-momentjs.com
-
@Ankita Jaiswal 你能解释一下你到底需要什么吗?
-
此时的代码,我没有日期,我会通过这种格式来本地化日期。
-
@Ajinkya 我想要这样的东西:句点:moment.period()。 moment.period() 这不是即时的函数。我想要一个返回本地化 AM/PM 的函数,就像我们有 moment.weekDays()
标签: javascript momentjs