Lesstep
Japanese era · 和暦 · Checked October 30, 2026

Japanese era dates that come out wrong

Japanese forms, invoices and government documents often write dates in the imperial era: 令和8年10月30日 is October 30, 2026. Eras change in the middle of a year (Heisei became Reiwa on May 1, 2019), and year 1 is written 元年, not 1. Let Intl format them:

const wareki = new Intl.DateTimeFormat(
  "ja-JP-u-ca-japanese",
  { dateStyle: "long",
    timeZone: "Asia/Tokyo" });

wareki.format(date);
// 令和8年10月30日
Day in Japanwareki.format()
2019-04-30平成31年4月30日
2019-05-01令和元年5月1日
1989-01-07昭和64年1月7日
1989-01-08平成元年1月8日

That is what Node.js 24 and Chromium 152 gave: each day in the right era, and year 1 as 元年. With era: "short" and numeric parts instead of dateStyle, year 1 came out as 令和1. Format in Asia/Tokyo: 15:30 UTC on April 30, 2019 was already 令和元年5月1日 in Japan, but formatted in UTC it gave 平成31年4月30日. Plain "ja-JP" uses the Gregorian calendar (2019年5月1日).

Reading a date typed in the era

To turn a typed era date into a real date, use the day each era began, not its year. 2019 is both Heisei 31 and Reiwa 1:

const ERAS = [
  ["令和", "2019-05-01"],
  ["平成", "1989-01-08"],
  ["昭和", "1926-12-25"],
  ["大正", "1912-07-30"],
];
const RE =
  /^(\D+)(\d+)年(\d+)月(\d+)日/;
const pad = (n) => n.padStart(2, "0");

function fromWareki(text) {
  const m = text.normalize("NFKC")
    .replace("元年", "1年").match(RE);
  const i = ERAS.findIndex(
    ([name]) => name === m?.[1]);
  if (i < 0) return null;
  const start = ERAS[i][1];
  const y = Number(start.slice(0, 4))
    + Number(m[2]) - 1;
  const iso = [y, pad(m[3]), pad(m[4])]
    .join("-");
  const end = ERAS[i - 1]?.[1] ?? "9";
  return iso >= start && iso < end
    ? iso : null;
}

It read 令和元年5月1日 and 令和1年5月1日 as 2019-05-01, full-width 令和8年10月30日 as 2026-10-30, and 昭和64年1月7日 as 1989-01-07. It returned null for 平成31年5月1日 and 令和元年4月30日, days those eras didn't have. It doesn't check that the day exists, so check 2月30日 as you would any date.

What went wrong in real apps

The rest of a Japanese check

A birthday or a contract date in the wrong era is a wrong date. The same pass catches Enter while typing Japanese (the fix), yen charged 100 times over (the fix), kanji drawn in their Chinese shapes (the fix), headings that break in the middle of a word (the fix), postal codes rejected when typed in Japanese (the fix), dates saved one day early in Japan (the fix), address forms in the American order (the fix), phone numbers sent to +81 with the 0 still in (the fix), PDFs with the Japanese missing (the fix), search that finds nothing in Japanese (the fix), previews cut down to “...” in Japanese (the fix), lists sorted in the wrong order (the fix), email subjects that arrive garbled (the fix), CSV files that open garbled in Excel (the fix), Japanese titles that give an empty URL slug (the fix), file names garbled on upload and download (the fix), full-width spaces that get past your checks (the fix), public holidays your app gets wrong (the fix), and vertical text that comes out sideways or upside down (the fix).

Lesstep translates web apps into Japanese and delivers them as one pull request. In Complete (US$249), we check every screen in Japanese, and try era dates on both sides of a change of era. The first step is a free sample.

Node.js is a trademark of the OpenJS Foundation; Chromium is a trademark of Google LLC. This page is not affiliated with or endorsed by either of them.

More: Enter sends the message while typing Japanese · Stripe charges 100 times too much in yen · Kanji in their Chinese shapes · Japanese headings that break in the middle of a word · Forms that reject numbers typed in Japanese · Dates that come out wrong for Japanese users · Address forms in the Japanese order · Japanese phone numbers in forms · Japanese text missing from your PDFs · Search that finds nothing in Japanese · Length limits that break in Japanese · Japanese lists sorted in the wrong order · Japanese email subjects that arrive garbled · Japanese CSV files that open garbled in Excel · Japanese titles that give an empty URL slug · Japanese file names garbled on upload and download · Full-width spaces that get past your checks · Japanese public holidays your app gets wrong · Japanese vertical text that comes out sideways or upside down · Japanese localization checklist · Japanese localization for your web app