tc39 / test262

Official ECMAScript Conformance Test Suite
Other
2.4k stars 466 forks source link

Allow alternative era for Chinese calendar #4309

Open anba opened 3 weeks ago

anba commented 3 weeks ago

Year 1 in the Chinese calendar corresponds to 2637 BCE in ICU4X.

See https://docs.rs/icu/latest/icu/calendar/chinese/struct.Chinese.html#year-and-era-codes.

ptomato commented 2 weeks ago

Similar to #4101, I'm hesitant to modify the tests to allow both results here. Either the ICU4C result is correct, or the ICU4X result is. That's something that ICU4X needs to sort out.

anba commented 2 weeks ago

This is different from #4101, because the different epoch year isn't a ICU4C vs. ICU4X difference, but a design decision from the Temporal polyfill. The Temporal polyfill formats dates using Intl.DateTimeFormat, which outputs in many cases the related Gregorian year, cf. new Intl.DateTimeFormat("en-u-ca-chinese").formatToParts(new Date).

Reading https://github.com/unicode-org/icu/blob/0357501948d2f0ab43c891f446e68f19b07b442d/icu4c/source/i18n/chnsecal.h#L52-L60, it seems like ICU4C and ICU4X actually agree on 2637 BCE as the initial epoch year.

And a similar modification was already allowed in #4079.

ptomato commented 2 weeks ago

OK, thanks, got it. If ICU4C and ICU4X both agree on the result, then my comment doesn't apply.