Skip to the content

Hikidashi引き出し

Era dates (和暦) and kanji numerals both ways, the dictionary forms of a conjugated word, a reading shared out over its kanji, words pulled from pasted text, and how hard a sentence is to read.

Hikidashi (引き出し) is a drawer: each tool is pulled out when it is wanted. About the name

Contents

Reference · Era years

eraOnDatefunction

The era year a day is in, from YYYY-MM-DD or a Date.

Exact where eraYearOf cannot be: 1989-01-07 is 昭和64 and 1989-01-08 is 平成1.

Import it

import { eraOnDate } from "@johnmorrisdotca/hikidashi/wareki";

Also exported from: @johnmorrisdotca/hikidashi

Definition

function eraOnDate(date: string | Date): EraYear | null

Parameters

NameTypeDescription
datestring | Date

A day as YYYY-MM-DD (full-width digits are read too), or a Date, read as the day it shows in its own time zone.

Returns

EraYear | null

The era year the day falls in; null for a day that is not on the calendar (the 30th of February), a text that is not YYYY-MM-DD, an invalid Date, or a day before 明治 began on 1868-10-23.

Examples

import { eraOnDate } from "@johnmorrisdotca/hikidashi/wareki";

console.log(eraOnDate("1989-01-07")?.era.kanji, eraOnDate("1989-01-08")?.era.kanji);
console.log(eraOnDate("2019-05-01")?.era.romaji, eraOnDate("2023-02-30"));
昭和 平成
Reiwa null

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/hikidashi 1.1.0.