2

Is there a way to use the ECMAScript Internationalization API with nodejs?

For now, i only need the timezone support:

new Date().toLocaleString("en-US", {timeZone: "America/New_York"})

which works very well with chrome, but not with node. Are there any options like --harmony to activate it?

hippietrail
  • 15,848
  • 18
  • 99
  • 158
user2491336
  • 187
  • 1
  • 12
  • While this doesn't answer your question, the title implies that you want the `intl` module. Unfortunately, timezone support is one of the remaining unimplemented features. – Aaron Dufour May 09 '14 at 18:43

1 Answers1

3

Internationalization is turned off in v8 when built for node.js. The reason is that the library that provides it significantly increases the size of the node binary for a small perceived gain. You can turn it back on if you're willing to build node from source. First you'll have to check out the github repo (https://github.com/joyent/node) and then do the following from the repo root:

svn checkout --force --revision 214189 \
    http://src.chromium.org/svn/trunk/deps/third_party/icu46 \
    deps/v8/third_party/icu46
./configure --with-icu-path=deps/v8/third_party/icu46/icu.gyp
make
make install

These instructions are from the README.md of that repo, which can be read at https://github.com/joyent/node

Aaron Dufour
  • 17,288
  • 1
  • 47
  • 69