Skip to content

Conversation

Manishearth
Copy link
Member

In https://github.com/unicode-org/icu4x/pull/7007/files#r2393049682 I noticed a Korean reference year was incorrect. At first I thought it was due to a KASI mismatch, but it turns out our algorithm matches KASI from 1912 onwards (#7008), and you can see the bug in our code too.

The bug was due to generate_reference_years() not doing Dangi: it can be edited to do Dangi, but you have to be careful to update it in two places. If you only change new_china() to new_dangi() you get buggy data.

I was surprised this wasn't caught by the reference year test. Turns out; the reference year test discards all dates that don't successfully go through MonthDay, and currently if the produced reference year is invalid, MonthDay construction errors.

I updated the test to instead understand what monthday combinations are valid for each calendar.

@Manishearth Manishearth requested a review from sffc as a code owner October 1, 2025 07:17
Copy link

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

@robertbastian robertbastian merged commit 76770d8 into unicode-org:main Oct 1, 2025
27 of 30 checks passed
robertbastian pushed a commit that referenced this pull request Oct 1, 2025
The code and data used for fetching this will be pushed up to a separate
(private) Unicode repo once we have one. You can find the cleaned up
source data in
https://gist.github.com/Manishearth/d8c94a7df22a9eacefc4472a5805322e.

I'm imagining that post-1950 data will change or be removed with
#7006



The initial motivation here was to fix the apparent ground truth
mismatch found in
https://github.com/unicode-org/icu4x/pull/7007/files#r2393049682. Turns
out it was a different problem, and it has been fixed in
#7013.

We may potentially need the same discussion as #6970 about whether we
care about these pre-1912 dates, since that's the only time this
diverges.
@Manishearth Manishearth deleted the reference-year-test-fixes branch October 1, 2025 15:46
(11, false, false) if day > 26 => 1971,
(11, false, false) => 1972,
(11, false, true) => 1969,
(11, false, true) => 1972,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@robertbastian This is incorrect: This date is Jan 4, 1973, which is after Dec 31, 1972.

The algorithm needs to look backwards from Dec 31.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately your code doesn't currently handle the Dec 31 boundary so this still needs manual edits.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah you had this like this in your PR so I changed the code to produce that (49c9dc6). I thought it needs to be a strict comparison

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see! Yeah, that works.

Hadn't looked at the next commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants