eraOnDate関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
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 { eraOnDate } from "@johnmorrisdotca/hikidashi/wareki";
ほかのエクスポート元: @johnmorrisdotca/hikidashi
定義
function eraOnDate(date: string | Date): EraYear | null
引数
| 名前 | 型 | 説明 |
|---|---|---|
date | string | Date | A day as |
戻り値
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.
例
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出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。