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

Human readable time zone transition dates #6124

Merged
merged 3 commits into from
Feb 16, 2025

Conversation

robertbastian
Copy link
Member

Now I can actually spot bugs.

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.

I agree very much with the goal; just some nitpicks/suggestions about code.

Comment on lines -269 to +275
pub(crate) fn fixed_from_iso(date: IsoDateInner) -> RataDie {
calendrical_calculations::iso::fixed_from_iso(date.0.year, date.0.month, date.0.day)
#[doc(hidden)]
pub fn to_fixed(date: Date<Iso>) -> RataDie {
calendrical_calculations::iso::fixed_from_iso(
date.inner.0.year,
date.inner.0.month,
date.inner.0.day,
)
Copy link
Member

Choose a reason for hiding this comment

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

Nit: I think fixed_from_iso is a string from Reingold.

I suggest adding new public functions to Date<Iso> called to_rata_die and from_rata_die.

Copy link
Member Author

Choose a reason for hiding this comment

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

and the method in calendrical_calculations will keep that name

Copy link
Member Author

Choose a reason for hiding this comment

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

let's not nitpick non-public names on this PR please, if you want to stabilise them please file an issue

Copy link
Member

Choose a reason for hiding this comment

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

ok, you know how I feel about #[doc(hidden)]. Can you at least reduce the diff and use the existing names please?

Copy link
Member Author

Choose a reason for hiding this comment

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

this goes from one doc-hidden API to two, because I need the other direction.

the diff is how it is because this crate previously had two to_fixed methods, now it has one

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 have time right now to review the big diff. I'll get to it soon, or sooner if the PR gets a smaller diff.

Copy link
Member Author

Choose a reason for hiding this comment

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

it's some tests that compile and pass

Comment on lines -347 to +342
(Iso::fixed_from_iso(*self.inner()) - Iso::fixed_from_iso(other.inner)) as i32
(Iso::to_fixed(*self) - Iso::to_fixed(other)) as i32
Copy link
Member

Choose a reason for hiding this comment

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

Nit: Too much of a diff.

Comment on lines +180 to +182
serializer.serialize_str(&alloc::format!(
"{year:04}-{month:02}-{day:02} {hour:02}:{minute:02}"
))
Copy link
Member

Choose a reason for hiding this comment

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

Suggestion: Use IXDTF syntax.

Copy link
Member Author

Choose a reason for hiding this comment

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

If it wasn't behind a feature I would

Copy link
Member Author

Choose a reason for hiding this comment

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

Comment on lines +196 to +200
if deserializer.is_human_readable() {
let e0 = D::Error::custom("invalid");
let e1 = |_| D::Error::custom("invalid");
let e2 = |_| D::Error::custom("invalid");
let e3 = |_| D::Error::custom("invalid");
Copy link
Member

Choose a reason for hiding this comment

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

Suggestion: Parse the string with ixdtf.

@robertbastian robertbastian requested a review from sffc February 14, 2025 19:05
@robertbastian robertbastian merged commit e2cf51f into unicode-org:main Feb 16, 2025
28 checks passed
@robertbastian robertbastian deleted the human branch February 16, 2025 21:30
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