Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect start date for Meiji era #4892

Open
anba opened this issue May 13, 2024 · 2 comments
Open

Incorrect start date for Meiji era #4892

anba opened this issue May 13, 2024 · 2 comments
Labels
blocked A dependency must be resolved before this is actionable C-calendar Component: Calendars tracking This issue tracks a ticket in another project U-ecma402 User: ECMA-402 compatibility

Comments

@anba
Copy link

anba commented May 13, 2024

The start date of the Meiji era is incorrectly reported as September 8, 1868 (Gregorian calendar). I guess the start date from CLDR is incorrectly assumed to be in the Gregorian calendar, even though in 1868 the Chinese lunar calendar was still in use in Japan.

(Tested with release 1.4.)

use icu::calendar::Date;
use icu::calendar::{Calendar, Ref};
use icu::calendar::japanese::Japanese;

fn main() {
  let cal = Japanese::new();
  let cal = Ref(&cal);

  // Meiji era started October 23, 1868. [1]
  //
  // October 23, 1868 is Meiji 1, 8th day of the 9th month in the Japanese
  // calendar.
  //
  // The seireki system was introduced in 1873, so after the start of the Meiji
  // era. [2]
  //
  // January 25, 1868 is possibly also a valid start date of the era [3].
  //
  // [1] https://en.wikipedia.org/wiki/Meiji_(era)
  // [2] https://en.wikipedia.org/wiki/Japanese_calendar#Gregorian_Calendar_(seireki)
  // [3] https://en.wikipedia.org/wiki/Kei%C5%8D#Events_of_the_Kei%C5%8D_era

  let date_iso = Date::try_new_iso_date(1868, 9, 8).unwrap();
  let date = Date::new_from_iso(date_iso, cal);

  // Era incorrectly reported as "meiji", but should instead be "ce".
  dbg!(date.year().era);

  let date_iso = Date::try_new_iso_date(1868, 9, 7).unwrap();
  let date = Date::new_from_iso(date_iso, cal);

  // Era correctly reported as "ce".
  dbg!(date.year().era);
}
@sffc
Copy link
Member

sffc commented May 13, 2024

UTS 35 says:

Era start or end dates are specified in terms of the equivalent proleptic Gregorian date (in "y-M-d" format). Eras may be open-ended, with unspecified start or end dates.

https://cldr-smoke.unicode.org/spec/main/ldml/tr35-dates.html#Supplemental_Calendar_Data

The CLDR data:

              <era type="232" start="1868-9-8" code="meiji"/>

So this might be an issue in CLDR.

@sffc
Copy link
Member

sffc commented May 13, 2024

There is already a CLDR issue about it:

https://unicode-org.atlassian.net/browse/CLDR-11375

@sffc sffc added blocked A dependency must be resolved before this is actionable tracking This issue tracks a ticket in another project C-calendar Component: Calendars labels May 13, 2024
@sffc sffc added this to the Backlog ⟨P4⟩ milestone May 13, 2024
@sffc sffc added the U-ecma402 User: ECMA-402 compatibility label May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked A dependency must be resolved before this is actionable C-calendar Component: Calendars tracking This issue tracks a ticket in another project U-ecma402 User: ECMA-402 compatibility
Projects
None yet
Development

No branches or pull requests

2 participants