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

Implement ixdtf for CustomTimeZone and CustomZonedDateTime #5349

Merged
merged 18 commits into from
Aug 16, 2024

Conversation

nekevss
Copy link
Contributor

@nekevss nekevss commented Aug 9, 2024

This PR is related to #5201.

It adds the below functionality to icu_timezone:

  • TryFrom for GmtOffset
  • IXDTF methods for CustomTimeZone
  • IXDTF methods for CustomZonedDateTime
  • Adds new_with_bcp47_id method to CustomTimeZone

Currently, the parsing doesn't resolve any inconsistency that may exist between a DateTime UTC Offset and a IANA identifier time zone annotation, going off the documentation comment that CustomTimeZone does not enforce consistency across all fields.

@nekevss nekevss requested review from nordzilla and a team as code owners August 9, 2024 02:58
@nekevss nekevss requested a review from Manishearth as a code owner August 9, 2024 03:57
@sffc sffc self-requested a review August 9, 2024 16:17
Copy link
Member

@sffc sffc left a comment

Choose a reason for hiding this comment

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

Nice work!

components/timezone/src/ixdtf.rs Outdated Show resolved Hide resolved
components/timezone/src/ixdtf.rs Outdated Show resolved Hide resolved
components/timezone/src/ixdtf.rs Outdated Show resolved Hide resolved
components/timezone/src/ixdtf.rs Show resolved Hide resolved
components/timezone/src/ixdtf.rs Outdated Show resolved Hide resolved
components/timezone/src/ixdtf.rs Outdated Show resolved Hide resolved
components/timezone/src/ixdtf.rs Outdated Show resolved Hide resolved
components/timezone/src/ixdtf.rs Outdated Show resolved Hide resolved
components/timezone/src/ixdtf.rs Outdated Show resolved Hide resolved
components/timezone/src/ixdtf.rs Outdated Show resolved Hide resolved
Comment on lines 280 to 281
let (year, month, day) =
date.map(|d| (d.year, d.month, d.day)).unwrap_or((0, 0, 0));
Copy link
Member

Choose a reason for hiding this comment

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

If the date or time is not present, then I think do not calculate the metazone. Only calculate it if all the fields are there.

@sffc sffc merged commit 600f2dd into unicode-org:main Aug 16, 2024
28 checks passed
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