I am building a GraphQL schema programmatically and in need of a Timestamp
scalar type; a Unix Epoch timestamp scalar type:
const TimelineType = new GraphQLObjectType({
name: 'TimelineType',
fields: () => ({
date: { type: new GraphQLNonNull(GraphQLTimestamp) },
price: { type: new GraphQLNonNull(GraphQLFloat) },
sold: { type: new GraphQLNonNull(GraphQLInt) }
})
});
Unfortunately, GraphQL.js doesn't have a GraphQLTimestamp
nor a GraphQLDate
type so the above doesn't work.
I am expecting a Date
input and I want to convert that to a timestamp. How would I go about creating my own GraphQL timestamp type?