Skip to content

Instantly share code, notes, and snippets.

@tomwray13
Created August 30, 2021 18:15
Show Gist options
  • Save tomwray13/5334914719b362083cca12a5ae59ccc8 to your computer and use it in GitHub Desktop.
Save tomwray13/5334914719b362083cca12a5ae59ccc8 to your computer and use it in GitHub Desktop.
Using DateTime in GraphQL
import { DateTimeResolver } from 'graphql-scalars'
const typeDefs = `
scalar DateTime
`
const resolvers = {
DateTime: DateTimeResolver,
}
@tomwray13
Copy link
Author

When creating a type you just now need to leverage the DateTime. E.g:

const typeDefs = `
    type User {
        createdAt: DateTime!
        ...
    }
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment