graphql-moment

0.0.2 • Public • Published

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

Package Sidebar

Install

npm i graphql-moment

Weekly Downloads

6

Version

0.0.2

License

MIT

Last publish

Collaborators

  • jiexi