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

Allow sub-millisecond resolution in LocalTime #2482

Open
sgoll opened this issue Aug 2, 2024 · 0 comments
Open

Allow sub-millisecond resolution in LocalTime #2482

sgoll opened this issue Aug 2, 2024 · 0 comments

Comments

@sgoll
Copy link

sgoll commented Aug 2, 2024

Description

Looking at the code of LocalTime, it seems that it explicitly allows only milliseconds as sub-second resolution. It is unclear (at least, to me) why this is the case. It seems unintuitive because both LocalDateTime as well as DateTime allow arbitrary precision for the sub-second part.1

I would like to suggest lifting this limitation in LocalTime to bring it closer to LocalDateTime and DateTime.

This has come up in graphql-rust/juniper#1270 (comment) where serialization of the most common Rust time libraries is restricted to millisecond resolution despite all of them supporting nanosecond resolution internally.

Unfortunately, this could be considered a breaking change because it places the burden of parsing sub-millisecond resolution on downstream consumers.2

Footnotes

  1. Despite neither the documentation of LocalDateTime nor DateTime indicating so.

  2. Although I would argue that most parsers should be able to handle the introduction of additional digits without any significant changes.

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

No branches or pull requests

1 participant