graphql-type-datetime
DateTime scalar type for GraphQL.js, following the ISO 8601 format.
Ex: 2018-05-28T10:26:39.359Z
Usage
This package exports a DateTime scalar GraphQL.js type:
;
GraphQL-tools
SDL withWhen using the SDL with GraphQL-tools, define GraphQLDateTime
as the resolver for the appropriate scalar type in your schema:
;; const typeDefs = `scalar DateTime type MyType { myField: DateTime} # ...`; const resolvers = DateTime: GraphQLDateTime; typeDefs resolvers ;
Dependency
To validate and parse the date with an ISO 8601 format, this library uses Moment.js
Related
This repository is inspired by graphql-type-json and graphql-iso-date