Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

How can I use graphql-iso-date with graphql-tag? #110

Open
dotku opened this issue Aug 14, 2019 · 1 comment
Open

How can I use graphql-iso-date with graphql-tag? #110

dotku opened this issue Aug 14, 2019 · 1 comment

Comments

@dotku
Copy link

dotku commented Aug 14, 2019

eg I have a type E with following statements

const GraphqlISODate  = require('graphql-iso-date');
const {GraphQLDate} = GraphqlISODate;

module.exports = gql`
type E {
 ... 
 purchaseDate: GraphQLDate
}
`

But I got error with GraphQLDate not found, how can I resolved it?

@pixeldrew
Copy link

pixeldrew commented Sep 4, 2019

This URL should help: https://www.apollographql.com/docs/graphql-tools/scalars/

Essentially, define a scalar in your schema as a type GraphQLDate in GQL and add the definition to your resolvers object.

module.exports = gql `
scalar GraphQLDate
type E {
  ...
  purchaseDate: GraphQLDate
}

Then where you define your resolvers import GraphQLDate as a key

resolvers = {
  GraphQLDate,
  ...
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants