Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

String versions of date scalars #1275

Closed
jlowcs opened this issue Dec 1, 2021 · 3 comments
Closed

String versions of date scalars #1275

jlowcs opened this issue Dec 1, 2021 · 3 comments

Comments

@jlowcs
Copy link

jlowcs commented Dec 1, 2021

Is your feature request related to a problem? Please describe.

As the available data scalars implementations serialize dates to Date objects, when using Apollo we end up with a difference of behavior between server-side and client-side, the former serializing to Date objects, while the latter leaves them as ISO strings.

Even without that inconsistency, it makes the migration from non-maintained graphql-iso-date difficult because of the change in types.

Describe the solution you'd like

Providing Date scalars that serialize to an ISO string would be a big help. For instance, adding a GraphQLDateTimeIsoString and a GraphQLDateIsoString.

Describe alternatives you've considered

Alternatives are either:

  • keep using graphql-iso-date with the risk of it not working with future graphql version, and having to use npm install --force because of peer dependencies
  • copy/pasting the code from graphql-iso-date in our app
  • forking graphql-iso-date and updating the peer deps
  • finding a solution to handle scalars client-side, and update our codebase to expect Date objects instead of strings

None of those are great :/

@josiah-roberts
Copy link
Contributor

+1, would really benefit from this.

@falkenhawk
Copy link

#1641

@ardatan
Copy link
Collaborator

ardatan commented May 18, 2023

LocalDateTime scalar is available now!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
4 participants