You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 arbitraryprecision 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
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 bothLocalDateTime
as well asDateTime
allow arbitrary precision for the sub-second part.1I would like to suggest lifting this limitation in
LocalTime
to bring it closer toLocalDateTime
andDateTime
.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
Despite neither the documentation of LocalDateTime nor DateTime indicating so. ↩
Although I would argue that most parsers should be able to handle the introduction of additional digits without any significant changes. ↩
The text was updated successfully, but these errors were encountered: