J2V8
J2V8 copied to clipboard
Date.toLocaleString doesn't support locales and options params
Nodejs doesn't support locales and options params in the next functions of Date's object: toLocaleString, toLocaleDateString, toLocaleTimeString? I have the snippet to check support:
(function() {
try {
new Date().toLocaleTimeString('i');
} catch (e) {
return e.name === 'RangeError';
}
return false;
})();
This code returns true in browsers and false in j2v8.
Seems as Nodejs supports functions without these params. And is it possible to run v8 in your project with custom locale, not the en-US?
I found the next: https://github.com/nodejs/node/issues/8500#issuecomment-246432058
I have found out that you build nodejs with flag --without-intl, maybe this is why locales and options params doesn't work.
When we frist started, internationalization added hundreds of MB to the library so we disabled it. If someone would like to try and build with i18l enabled and report back about the impact, we could then make a plan.
Thanks for reply! Yet one question: is it possible to build j2v8 and include (third party node module)? If yes, could you forward me to example how to do that?
@irbull Making localization pluggable could be an option. Often times the underlying os is able to provide the current timezone offset.