Skip to content

How to format datetime scalar in query? #2290

Answered by ryands17
ryanking1809 asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @ryanking1809 👋

createdAt will accept arguments for data types that are either a Date or a String.

So you could query for posts in the following manner,

query {
  posts(where: { createdAt: { lt: new Date() } }) {
    id,
  }
}

or you could pass a timestamp value as a String as well.

Let me know if that solves this!

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ryanking1809
Comment options

Answer selected by ryanking1809
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants