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

IXDTF parsers: Improve docs and add PartialEq #5993

Merged
merged 1 commit into from
Jan 15, 2025

Conversation

sffc
Copy link
Member

@sffc sffc commented Jan 15, 2025

#5739

This is mostly docs. The only non-docs is adding PartialEq bounds, including to DateTime and ZonedDateTime, which became reachable via one of my new docs tests. I think adding PartialEq to DateTime is not in contradiction to the thin DateTime effort.

components/timezone/src/ixdtf.rs Show resolved Hide resolved
/// use icu_timezone::{IxdtfParser, TimeZoneInfo, UtcOffset};
///
/// let tz_from_offset = IxdtfParser::new()
/// .try_offset_only_from_str("2024-08-08T12:08:19-05:00", Gregorian)
/// .try_offset_only_from_str("2024-08-08T12:08:19-05:00", Iso)
Copy link
Member

Choose a reason for hiding this comment

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

I don't think using Iso as the calendar argument is a good example. First of all, you could be using try_offset_only_from_iso_str, and second Iso doesn't implement CldrCalendar, so it needs to be converted before formatting.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't want to overuse Gregorian in docs. It is an antipattern because it is a "strong" calendar in the sense that it overrides the locale calendar during formatting if using a FixedCalendarDTF, which exists for code size only. Better style is to get the calendar from somewhere and then pass it into the parse function, not hardcode something. ISO is slightly better in this example because it can't be used for formatting. I was concerned about this in your PR earlier but didn't want to stop it from landing.

Copy link
Member

Choose a reason for hiding this comment

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

maybe just a mix of calendars then?

@robertbastian robertbastian merged commit 5b8e8c0 into unicode-org:main Jan 15, 2025
28 checks passed
@sffc sffc deleted the docs-5739 branch January 15, 2025 17:42
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.

3 participants