I was using "internal" moment.js API to override formatting of current locale - namely disabling arabic number symbols. So instead of ١١ أيلول سبتمبر ٢٠١٥ ١٩:٥٣ I would have 11 سبتمبر/ أيلول 2015 19:53
But after upgrading to v 2.10.x, this internal hack broke and I cannot find how to hook into moment and override this
moment.locale("ar");
moment._locale.postformat = function (input) { return input; };
document.write(moment().format("LLL"));
v2.8.x http://jsbin.com/faziyu/3/edit?html,js,console,output
v2.10.x http://jsbin.com/faziyu/4/edit?html,js,console,output
"TypeError: Cannot set property 'postformat' of undefined
Thanks for help in advance :)
I know the question is old but coming across in in my project. Just use moment()._locale with brackets to access the internal _locale property.
v2.18.1: http://jsbin.com/comosidida/embed
moment.locale("ar");
moment()._locale.postformat = function (string) { return string; }; // jshint ignore:line
document.write(moment().format("LLL"));
Note: There is a little difference in print between both version coming from moment.js.
v2.8:6 سبتمبر/ أيلول 2017 10:59
v2.18.1: 6 أيلول سبتمبر 2017 10:59
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With