Deno porting of go-erajp.
Deno modules for japanese era.
(日本の元号を扱う為のライブラリであるgo-erajpをDeno向けに移植したものです。)
// example.ts
import { toEraFromTime } from "./mod.ts";
console.log(toEraFromTime(new Date())); // 令和
console.log(toEraFromTime(new Date("2019/5/1"))); // 令和
console.log(toEraFromTime(new Date("2019/4/30"))); // 平成--allow-read option needs to be added.
deno run --allow-read example.tsdeno test --allow-readIf the version is older than 1.18, add --unstable.
deno test --allow-read --unstableThe implementation in this repository is a port of the implementation in this repository (go-erajp) for Deno.
The Licence is MIT, according to the license of go-erajp.