wareki2era.js
convert Japanese Wareki(日本の元号 | 和暦) to the Era(西暦) for javascript
wareki2era.js is tiny javascript library. which is able to convert Japanese Wareki(和暦|元号) to Era (西暦).
Installation
# npm npm i wareki2era# yarn yarn add wareki2era
Or you can import directly via CDN.
Basic Usage
wareki2era( JapaneseEraDate ) : String
japaneseEraDate
shoud be(明治|大正|昭和|平成|令和)YYYY年MM月DD日
CommonJS (node.js) || ES6 or later (babel)
const wareki2era = ;// import wareki2era from "wareki2era"; let jpnEra = "明治四五年一二月十日"; ; // 1912-12-10
Web browser
With options
With second argument, you can assgin splited character whatever you want.
var jpnEra = "明治四五年一二月十日"; // default; // 1912-12-10 // with option; // 1912/12/10; // 1912#12#10
In addition j
option is return japanese date of string.
// with 'j' option; // 1912年12月10日
Changelog
- version 1.0.0 : Adapted '令和'
Credit
Special thanks to http://sm.2-d.jp's liblary. wareki2era.js
is using it while converting kan-suji(漢数字) to Arabic number.
Licence
MIT