Page MenuHomePhabricator

Fix incorrect Japanese era handling
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Install ParsetFunction and Latest MediaWiki,
  • Go to optional edit page
  • put contents below and save the page:
明治前 (Out of scope of Meiji era)
*{{#time:xtY年Mj日 H:i:s | 18660101000000 }}
*{{#time:xtY年Mj日 H:i:s | 18670101000000 }}
明治 (Meiji before using Gregorian calendar)
*{{#time:xtY年Mj日 H:i:s | 18681022000000 }}
*{{#time:xtY年Mj日 H:i:s | 18681023000000 }}
*{{#time:xtY年Mj日 H:i:s | 18721231000000 }}
明治グレゴリオ暦開始 (Meiji After using Gregorian calendar)
*{{#time:xtY年Mj日 H:i:s | 18730101000000}}
*{{#time:xtY年Mj日 H:i:s | 19120729235959 }}
大正 (Taisho)
*{{#time:xtY年Mj日 H:i:s | 19120730000000 }}
*{{#time:xtY年Mj日 H:i:s | 19120730235959 }}
*{{#time:xtY年Mj日 H:i:s | 19120731000000 }}
*{{#time:xtY年Mj日 H:i:s | 19261224235959 }}
昭和 (Showa)
*{{#time:xtY年Mj日 H:i:s | 19261225000000 }}
*{{#time:xtY年Mj日 H:i:s | 19261225235959 }}
*{{#time:xtY年Mj日 H:i:s | 19261226000000 }}
*{{#time:xtY年Mj日 H:i:s | 19890107235959 }}
平成 (Heisei)
*{{#time:xtY年Mj日 H:i:s | 19890108000000 }}
*{{#time:xtY年Mj日 H:i:s | 19890201000000 }}
*{{#time:xtY年Mj日 H:i:s | 20190101000000 }}
*{{#time:xtY年Mj日 H:i:s | 20190430235959 }}
令和 (Reiwa)
*{{#time:xtY年Mj日 H:i:s | 20190501000000}}
*{{#time:xtY年Mj日 H:i:s | 20240101000000}}

What happens?:

明治前 (Out of scope of Meiji era)

明治-1年1月1日 00:00:00
明治0年1月1日 00:00:00
明治 (Meiji before using Gregorian calendar)

明治元年10月22日 00:00:00
明治元年10月23日 00:00:00
明治5年12月31日 00:00:00
明治グレゴリオ暦開始 (Meiji After using Gregorian calendar)

明治6年1月1日 00:00:00
明治45年7月29日 23:59:59
大正 (Taisho)

明治45年7月30日 00:00:00
明治45年7月30日 23:59:59
大正元年7月31日 00:00:00
大正15年12月24日 23:59:59
昭和 (Showa)

大正15年12月25日 00:00:00
大正15年12月25日 23:59:59
昭和元年12月26日 00:00:00
昭和64年1月7日 23:59:59
平成 (Heisei)

平成元年1月8日 00:00:00
令和-29年2月1日 00:00:00
平成31年1月1日 00:00:00
平成31年4月30日 23:59:59
令和 (Reiwa)

令和元年5月1日 00:00:00
令和6年1月1日 00:00:00

What should have happened instead?:

明治前 (Out of scope of Meiji era)

西暦1866年1月1日 00:00:00
西暦1867年1月1日 00:00:00
明治 (Meiji before using Gregorian calendar)

西暦1868年10月22日 00:00:00
西暦1868年10月23日 00:00:00
西暦1872年12月31日 00:00:00
明治グレゴリオ暦開始 (Meiji After using Gregorian calendar)

明治6年1月1日 00:00:00
明治45年7月29日 23:59:59
大正 (Taisho)

大正元年7月30日 00:00:00
大正元年7月30日 23:59:59
大正元年7月31日 00:00:00
大正15年12月24日 23:59:59
昭和 (Showa)

昭和元年12月25日 00:00:00
昭和元年12月25日 23:59:59
昭和元年12月26日 00:00:00
昭和64年1月7日 23:59:59
平成 (Heisei)

平成元年1月8日 00:00:00
平成元年2月1日 00:00:00
平成31年1月1日 00:00:00
平成31年4月30日 23:59:59
令和 (Reiwa)

令和元年5月1日 00:00:00
令和6年1月1日 00:00:00

Software version (skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):

  • Before of Meiji 6th, it uses Lunisolar calendar. Should not convert simply year.
  • Taisho period starts from 1912-07-30. Not 31.
  • Showa period starts from 1926-12-25. Not 26.
  • Feb to Dec of The first Heisei period year (1989), it returns incorrect year (I made this bug in T219728 ).

Event Timeline

Rxy triaged this task as Medium priority.

Change 995056 had a related patch set uploaded (by Rxy; author: Rxy):

[mediawiki/core@master] Fix and split Japanese era related logic

https://gerrit.wikimedia.org/r/995056

Change 995056 merged by jenkins-bot:

[mediawiki/core@master] Fix and split Japanese era related logic

https://gerrit.wikimedia.org/r/995056

merged, and deployed 1.42.0-wmf.19 at wikimedia wikis