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

temporal: use uppercase unit designator labels by default #191

Merged
merged 1 commit into from
Jan 2, 2025

Conversation

BurntSushi
Copy link
Owner

@BurntSushi BurntSushi commented Jan 2, 2025

This somewhat revives #22, but makes it possible to restore the previous
behavior by enabling jiff::fmt::temporal::SpanPrinter::lowercase.

The main motivation here is also detailed in #22, and it came up again
in #190. I was previously reluctant to do this because I find
P1Y2M3DT4H5M6S hideously difficult to read and P1y2m3dT4h5m6s
somewhat less difficult to read. But now that jiff::fmt::friendly is a
thing and users have easy access to a more readable duration display
format, I feel less bad about this. It's still a shame that it's the
default via span.to_string(), but I tried to sprinkle a few
format!("{span:#}") in places to nudge users toward the friendly
format.

It's a shame more systems don't accept lowercase unit designator labels,
but since Jiff uses the ISO 8601 by default specifically for its
interoperability, it makes sense to be as interoperable as we can by
default.

Fixes #190

This somewhat revives #22, but makes it possible to restore the previous
behavior by enabling `jiff::fmt::temporal::SpanPrinter::lowercase`.

The main motivation here is also detailed in #22, and it came up again
in #188. I was previously reluctant to do this because I find
`P1Y2M3DT4H5M6S` hideously difficult to read and `P1y2m3dT4h5m6s`
somewhat less difficult to read. But now that `jiff::fmt::friendly` is a
thing and users have easy access to a more readable duration display
format, I feel less bad about this. It's still a shame that it's the
default via `span.to_string()`, but I tried to sprinkle a few
`format!("{span:#}")` in places to nudge users toward the friendly
format.

It's a shame more systems don't accept lowercase unit designator labels,
but since Jiff uses the ISO 8601 by default specifically for its
interoperability, it makes sense to be as interoperable as we can by
default.

Fixes #188
@BurntSushi BurntSushi force-pushed the ag/iso-8601-default-to-uppercase branch from c748663 to deb0233 Compare January 2, 2025 14:04
@BurntSushi BurntSushi merged commit d100b15 into master Jan 2, 2025
18 checks passed
@BurntSushi BurntSushi deleted the ag/iso-8601-default-to-uppercase branch January 2, 2025 14:28
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.

SignedDuration's Display should use upper case letter
1 participant