dayjs-jp-format
day.jsのformat関数にて日本の元号を表示するためのプラグインです。
A plugin is an independent module that can be added to Day.js to extend functionality or add japanse calendar features.
Usage
-
Install the repository
$ npm install --save dayjs-jp-format$ npm install --save dayjs # peer dependencyor
$ yarn add dayjs-jp-format$ yarn add dayjs # peer dependency -
Import the jp format
dayjs // use pluginconst date = '2020-06-24'// --> 令和02
Format
Format | Output | Description |
---|---|---|
rr |
令和 | 日付に応じた元号 |
rrrr |
令和02 | 日付に応じた和暦(年は除く) |