Date custom scalar type - GraphQL
$ npm i -S @tadashi/gql-scalar-date
import {
GraphQLSchema,
GraphQLObjectType,
} from 'graphql'
import GraphQLDateScalar from '@tadashi/gql-scalar-date'
const schema = new GraphQLSchema({
query: new GraphQLObjectType({
name: 'RootQueryType',
fields: {
now: {
type: GraphQLDateScalar,
resolve() {
return new Date()
},
},
},
}),
})
MIT © Thiago Lagden