-
Notifications
You must be signed in to change notification settings - Fork 436
Description
Description
This is a proposal to add first-class support for the data types from Jiff. First-class support is necessary, and an external crate would be much more inconvenient to use, because of Rust's orphan rule as outlined in #87 (comment).
This should cover the following date/time types:
Timestamps
Timestamp
, serialized as RFC 3339 (ISO 8601) date/time with UTC time zone, GraphQL scalarDateTime
, e.g.2024-06-19T19:22:45Z
Zoned
, serialized as RFC 9557 date/time with time zone, GraphQL scalarZonedDateTime
1, e.g.2024-07-04T08:39:00-04:00[America/New_York]
Wall-clocked
Date
, serialized as date, without time zone, GraphQL scalarLocalDate
, e.g.2024-06-19
Time
, serialized as time, without time zone, GraphQL scalarLocalTime
, e.g.15:22:45
DateTime
, serialized as date/time, without time zone, GraphQL scalarLocalDateTime
, e.g.2024-06-19T15:22:45
Durations
Time zones
Where types overlap, the resulting serialization would be identical to the one for the chrono
and time
crates, with the difference of using GraphQL scalar LocalDate
instead of Date
.2
I am aware that Jiff is a very new library but I think it has great potential in the ecosystem. Having dealt with date/time intricacies in several projects, I regard it as one of the top-contenders for following or eventually even superseding chrono
/time
.
I am willing to provide a PR if this proposal is accepted. See #1271 for a PR that implements these features.
See #1272 for a PR that adds support for the types Zoned
and TimeZone
.
Footnotes
-
This always includes the time zone specifier and uses RFC
85369557. This format seems not widely used yet. It is also not a valid input for GraphQL scalarDateTime
, therefore we serialize it as the GraphQL scalarZonedDateTime
which has not been stabilized, or even defined elsewhere, yet. ↩ -
LocalDate
seems to be the more appropriate type. I am not sure whychrono
andtime
integration chose to useDate
instead. ↩