LoginSignup
3
1

More than 3 years have passed since last update.

Node.js で令和元年 (full-icu + toLocaleDateString)。

Posted at

Node.js はデフォルトでは日本語関連の ICU データを持っていないので、別途インストールする必要があります。

> npm i full-icu

で、これを指定して実行してあげましょう。

> node -v
v12.1.0
> node --icu-data-dir=node_modules/full-icu -p "new Date().toLocaleDateString('ja-JP-u-ca-japanese', { era: 'long' })"
令和元年5月1日
3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1