使用 momentjs 获取语言环境格式 [英] Get locale format with momentjs

查看:22
本文介绍了使用 momentjs 获取语言环境格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试根据位置恢复日期格式.例如,如果我使用 moment.locale('fr') 检索 "DD/MM/YYYY" 或检索 "YYYY/MM/DD"moment.locale('en').如您所见,我使用 MomentJS 进行日期管理.

I am trying to recover the date format according to the location. For example, if I use moment.locale('fr') retrieve "DD/MM/YYYY" or retrieve "YYYY/MM/DD" with moment.locale('en'). As you can see, I use MomentJS for my date management.

是否有 MomentJS 函数来恢复格式?

Is there a MomentJS function to recover the format?

推荐答案

我要找的是:

moment().creationData().locale._longDateFormat.L

感谢 Aprillion,我找到了答案.谢谢!

I found the answer thanks to Aprillion. Thanks!

这篇关于使用 momentjs 获取语言环境格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆