Checking the current Moment.js locale1.6.0+
// From version 2.8.1 onward
moment.locale();
// Deprecated in version 2.8.1
moment.lang();
If you are changing locales frequently, you may want to know what locale is currently being used. This is as simple as calling moment.locale
without any parameters.
moment.locale('en'); // set to english
moment.locale(); // returns 'en'
moment.locale('fr'); // set to french
moment.locale(); // returns 'fr'
As of version 2.12.0 it is possible to list all locales that have been loaded and are available to use:
moment.locales()
当前内容版权归 momentjs.com 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 momentjs.com .