Skip to content

jiexi/graphql-moment

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

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

About

GraphQL Moment Date Type

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • CoffeeScript 93.4%
  • JavaScript 6.6%