0.0.2 • Published 7 years ago

graphql-moment v0.0.2

Weekly downloads
15
License
MIT
Repository
github
Last release
7 years ago

graphql-moment Build Status

GraphQL Moment Date Type

Installation

npm i --save graphql-moment

Usage

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 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'
    }
  }
});

Built-in date formats

GraphQLDate // Standard ISO 8601
GraphQLUnixTime // Milliseconds since 1970-01-01 UTC
GraphQLMMDDYYYY // MM-DD-YYYY format
GraphQLYYYYMMDD // YYYY-MM-DD format

Custom date formats

GraphQLTime = Factory('h:mm:ss', 'Time')
GraphQLEmit = Factory('ss:mm:h', 'Emit')

License

MIT

Based on

https://github.com/tjmehta/graphql-date