GraphQL Moment Date Type
npm i --save graphql-moment
var {Factory, GraphQLDate} = require('graphql-moment')
// Use graphql-moment in your GraphQL objects for Date properties
var fooType = new GraphQLObjectType({
name: 'Foo',
description: 'Some foo type',
fields: {
created: {
type: GraphQLDate, // defaults to standard ISO 8601 date format
description: 'Date foo was created'
}
}
});
var barType = new GraphQLObjectType({
name: 'Bar',
description: 'Some bar type',
fields: {
created: {
type: Factory('h:mm:ss', 'Time'), // custom date format type called 'Time'
description: 'Time bar was created'
}
}
});
GraphQLDate // Standard ISO 8601
GraphQLUnixTime // Milliseconds since 1970-01-01 UTC
GraphQLMMDDYYYY // MM-DD-YYYY format
GraphQLYYYYMMDD // YYYY-MM-DD format
GraphQLTime = Factory('h:mm:ss', 'Time')
GraphQLEmit = Factory('ss:mm:h', 'Emit')
MIT