我正在尝试根据位置恢复日期格式。例如,如果我使用moment.locale('fr')检索"DD/MM/YYYY"或使用moment.locale('en')检索"YYYY/MM/DD"。如您所见,我使用MomentJS进行日期管理。
有没有MomentJS函数来恢复格式?
发布于 2018-04-16 16:18:32
我要找的是:
moment().creationData().locale._longDateFormat.L
多亏了Aprillion,我找到了答案。谢谢!
发布于 2018-11-08 23:39:53
moment.localeData().longDateFormat('L') // "MM/DD/YYYY"和
moment.localeData('fr').longDateFormat('L') // "DD/MM/YYYY"看起来好多了
发布于 2018-08-24 03:27:20
我遇到了同样的问题,我得到了一种更复杂的方法来解决这个问题,只需要:
moment().format('L')而不是这个带有eslint警告的冗长解决方案:
moment().creationData().locale._longDateFormat.Lhttps://stackoverflow.com/questions/49852110
复制相似问题