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

eraYearOffunction

The era year a Western year is usually written as: the newest era's, so 1989 is 平成1 and 2019 is 令和1. Use eraYearsOf to get both of a changeover year, or eraOnDate when the day is known.

Import it

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

Also exported from: @johnmorrisdotca/hikidashi

Definition

function eraYearOf(westernYear: number): EraYear | null

Parameters

NameTypeDescription
westernYearnumber

A Western year, such as 2024.

Returns

EraYear | null

The newest era year in that Western year; null where eraYearsOf has nothing (before 1868, past the reach of the era still running, or not a whole year).

Examples

import { eraYearOf, formatEraYearJapanese } from "@johnmorrisdotca/hikidashi/wareki";

console.log(formatEraYearJapanese(eraYearOf(2024)!), formatEraYearJapanese(eraYearOf(1989)!));
console.log(eraYearOf(1700));
令和6年 平成1年
null

What it prints (run when this page was built)

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