Skip to content

Wrong Intl.DateTimeFormat formatting #13907

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
brawaru opened this issue Jun 25, 2017 · 3 comments
Closed

Wrong Intl.DateTimeFormat formatting #13907

brawaru opened this issue Jun 25, 2017 · 3 comments
Labels
i18n-api Issues and PRs related to the i18n implementation. question Issues that look for answers.

Comments

@brawaru
Copy link

brawaru commented Jun 25, 2017

  • Version: v8.1.2 / v7.9.0
  • Platform: Windows 10 Pro 1703 (16226.1000, Insider Build)

Intl.DateTimeFormat function gives wrong results in NodeJS

new Intl.DateTimeFormat('ru-RU', {
  month: 'long',
  day: 'numeric',
  year: 'numeric'
}).format(new Date())

Expected result (from Chrome 58.0.3029.110): '25 июня 2017 г.'
Actual result:

  • v8.1.2: '2017 M06 25'
  • v7.9.0: 'June 25, 2017
@TimothyGu
Copy link
Member

You need to install full ICU data, as the default Node.js build does not come with any locale other than English. Check out https://github.com/nodejs/node/wiki/Intl and the full-icu npm package.

@vsemozhetbyt vsemozhetbyt added the i18n-api Issues and PRs related to the i18n implementation. label Jun 25, 2017
@TimothyGu TimothyGu added the question Issues that look for answers. label Jun 25, 2017
@brawaru
Copy link
Author

brawaru commented Jun 25, 2017

Thanks for info. But there's a problem with full-icu package: nodejs/full-icu-npm#6 (comment)
Node v8 not auto detects it..

@TimothyGu
Copy link
Member

@DaFri-Nochiterov You can use either the NODE_ICU_DATA environment variable or the --icu-data-dir CLI parameter. Check out my current WIP documentation for Intl: https://gist.github.com/TimothyGu/e3659a3e51440e1733751f675c81321c#providing-icu-data-at-runtime (I will submit this as a PR soon).

Closing this issue. If you have further questions, please file an issue on the Help repository https://github.com/nodejs/help. Thanks!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
i18n-api Issues and PRs related to the i18n implementation. question Issues that look for answers.
Projects
None yet
Development

No branches or pull requests

3 participants