Skip to content

Conversation

@sylvestre
Copy link
Contributor

built on top of
#10457

@sylvestre sylvestre force-pushed the year-locale branch 2 times, most recently from 16a4b2d to 1684817 Compare January 24, 2026 20:19
@github-actions
Copy link

GNU testsuite comparison:

Congrats! The gnu test tests/date/date-ethiopia is no longer failing!
Congrats! The gnu test tests/date/date-iran is no longer failing!
Congrats! The gnu test tests/date/date-thailand is no longer failing!
Note: The gnu test tests/seq/seq-epipe is now being skipped but was previously passing.
Note: The gnu test tests/tail/tail-n0f is now being skipped but was previously passing.

@sylvestre sylvestre marked this pull request as ready for review January 24, 2026 21:37
@github-actions
Copy link

GNU testsuite comparison:

Congrats! The gnu test tests/date/date-ethiopia is no longer failing!
Congrats! The gnu test tests/date/date-iran is no longer failing!
Congrats! The gnu test tests/date/date-thailand is no longer failing!

Implements era year calculation for Buddhist, Persian Solar Hijri, and Ethiopian calendars based on locale detection. The %Y format specifier now outputs era-appropriate years while maintaining Gregorian calendar for ISO-8601 and RFC-3339 formats for interoperability.
@github-actions
Copy link

GNU testsuite comparison:

Congrats! The gnu test tests/date/date-ethiopia is no longer failing!
Congrats! The gnu test tests/date/date-iran is no longer failing!
Congrats! The gnu test tests/date/date-thailand is no longer failing!

/// # Returns
/// * `Some((era_year, month, day))` - Date in target calendar system
/// * `None` - If conversion fails
pub fn convert_date_to_locale_calendar(
Copy link
Collaborator

Choose a reason for hiding this comment

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

So this function isn't really correct since the days in a month is different in these calendars, it can give you the correct result for years, but this is still one of those examples where it would be better to directly use Jiff ICU instead of doing this conversion ourselves.

@ChrisDryden
Copy link
Collaborator

On a high level just the same feedback from the previous PR for the date utility, I think this is the right high level approach to take, but that we should use the jiff-icu library for doing the final conversions since there's a bunch of edge cases here. But this is something that doesn't need to be done with this PR. The main benefit I see here is adding the ICU-locale library and adding the logic for detecting which calendar to use which we can build off in future PR's.

@ChrisDryden ChrisDryden merged commit 6124866 into uutils:main Jan 26, 2026
132 checks passed
@sylvestre sylvestre deleted the year-locale branch January 26, 2026 19:09
@sylvestre
Copy link
Contributor Author

@ChrisDryden do you want to do the next steps ? or should i ? thanks

@ChrisDryden
Copy link
Collaborator

Mind if I make an example right now of what I was thinking for one of them using jiff-icu and then we can see if we're aligned?

@sylvestre
Copy link
Contributor Author

au contraire :)

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