Javascript 如何覆盖版本2.10.x中的矩.js区域设置格式,在2.8.x中使用

Javascript 如何覆盖版本2.10.x中的矩.js区域设置格式,在2.8.x中使用,javascript,momentjs,Javascript,Momentjs,我使用“internal”moment.js API覆盖当前语言环境的格式设置,即禁用阿拉伯数字符号。因此,与《代码》不同,我会选择《代码》第11章第19:53节 但在升级到v2.10.x之后,这个内部黑客程序崩溃了,我找不到如何连接到这个时刻并覆盖它 moment.locale("ar"); moment._locale.postformat = function (input) { return input; }; document.write(moment().format("LLL"))

我使用“internal”moment.js API覆盖当前语言环境的格式设置,即禁用阿拉伯数字符号。因此,与《代码》不同,我会选择《代码》第11章第19:53节

但在升级到v2.10.x之后,这个内部黑客程序崩溃了,我找不到如何连接到这个时刻并覆盖它

moment.locale("ar");
moment._locale.postformat = function (input) { return input; };
document.write(moment().format("LLL"));
v2.8.x

v2.10.x

TypeError:无法设置未定义的属性“postformat”


提前感谢您的帮助:)

我知道这个问题很老,但在我的项目中会遇到。只需使用带括号的
moment()。\u locale
即可访问内部的\u locale属性

v2.18.1:

注意:来自moment.js的两个版本的打印版本略有不同

v2.8:6 2017年10:59

v2.18.1:6ألوسبتم㶖㶖2017 10:59

moment.locale("ar");
moment()._locale.postformat = function (string) { return string; }; // jshint ignore:line
document.write(moment().format("LLL"));