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

Audit datetime format function #5789

Merged
merged 9 commits into from
Nov 7, 2024
Merged

Conversation

robertbastian
Copy link
Member

@robertbastian robertbastian commented Nov 7, 2024

I've found several bugs:

  • FieldLength::TwoDigit truncates the number, which is incorrect. Only the yy and YY patterns require truncation. I've moved this code to the year branch, and renamed the variant Two
  • c..cc and e..ee require locale-sensitive day-of-week-number calculations, so they are now rejected during data loading
  • FieldLength::{Abbreviated, Wide, Narrow} also apply to numeric fields, where they mean 3, 4, 5. I renamed them and updated documentation.
  • Cyclic year names should be loaded from data (Add data for cyclic year names #3761)

@sffc
Copy link
Member

sffc commented Nov 7, 2024

The names of the FieldLength enum variants predate my time working on this crate. I assume they were chosen to reflect the primary use case for those widths, even if they mean different things in different contexts

sffc
sffc previously approved these changes Nov 7, 2024
option_value.ok_or(GetNameForDayPeriodError::NotLoaded)
}

pub(crate) fn get_name_for_cyclic(
Copy link
Member Author

Choose a reason for hiding this comment

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

here

@robertbastian robertbastian requested review from sffc and removed request for zbraniecki and Manishearth November 7, 2024 07:32
Manishearth
Manishearth previously approved these changes Nov 7, 2024
sffc
sffc previously approved these changes Nov 7, 2024
components/datetime/src/format/datetime.rs Show resolved Hide resolved
@robertbastian robertbastian dismissed stale reviews from sffc and Manishearth via 15e1d64 November 7, 2024 16:42
Manishearth
Manishearth previously approved these changes Nov 7, 2024
@robertbastian robertbastian requested a review from sffc November 7, 2024 17:13
@robertbastian robertbastian merged commit 2d26b19 into unicode-org:main Nov 7, 2024
28 checks passed
@robertbastian robertbastian deleted the mhh branch November 7, 2024 17:25
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