-
Notifications
You must be signed in to change notification settings - Fork 185
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
Conversation
There was a problem hiding this 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.
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, | ||
) |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
(Iso::fixed_from_iso(*self.inner()) - Iso::fixed_from_iso(other.inner)) as i32 | ||
(Iso::to_fixed(*self) - Iso::to_fixed(other)) as i32 |
There was a problem hiding this comment.
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.
serializer.serialize_str(&alloc::format!( | ||
"{year:04}-{month:02}-{day:02} {hour:02}:{minute:02}" | ||
)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: Use IXDTF syntax.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the syntax from CLDR metazones.xml: https://github.com/unicode-org/cldr/blob/2cd040906853ce18c3b87bcf270b3526537c66cc/common/supplemental/metaZones.xml#L23
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"); |
There was a problem hiding this comment.
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
.
Now I can actually spot bugs.