Giter Club home page Giter Club logo

graphql-iso-date's Introduction

GraphQL ISO Date

npm version Build Status codecov

NOTICE: The scalars defined in this repository have moved to the GraphQL-scalars repository where they will be maintained.

GraphQL ISO Date is a set of RFC 3339 compliant date/time scalar types to be used with graphQL.js.

RFC 3339 "defines a date and time format for use in Internet protocols that is a profile of the ISO 8601 standard for representation of dates and times using the Gregorian calendar."

Date and Time on the Internet: Timestamps, July 2002.

A basic understanding of GraphQL and of the graphQL.js implementation is needed to provide context for this library.

This library contains the following scalars:

  • Date: A date string, such as 2007-12-03.
  • Time: A time string at UTC, such as 10:15:30Z
  • DateTime: A date-time string at UTC, such as 2007-12-03T10:15:30Z.

Getting started

Install graphql-iso-date using yarn

yarn add graphql-iso-date

Or using npm

npm install --save graphql-iso-date

GraphQL ISO Date exposes 3 different date/time scalars that can be used in combination with graphQL.js. Let's build a simple schema using the scalars included in this library and execute a query:

import {
  graphql,
  GraphQLObjectType,
  GraphQLSchema,
} from 'graphql';

import {
  GraphQLDate,
  GraphQLTime,
  GraphQLDateTime
} from 'graphql-iso-date';

const schema = new GraphQLSchema({
  query: new GraphQLObjectType({
    name: 'Query',
    fields: {
      birthdate: {
        type: GraphQLDate,
        //resolver can take a Date or date string.
        resolve: () => new Date(1991, 11, 24)
      },
      openingNYSE: {
        type: GraphQLTime,
        //resolver can take a Date or time string.
        resolve: () => new Date(Date.UTC(2017, 0, 10, 14, 30))
      },
      instant: {
        type: GraphQLDateTime,
        // resolver can take Date, date-time string or Unix timestamp (number).
        resolve: () => new Date(Date.UTC(2017, 0, 10, 21, 33, 15, 233))
      }
    }
  })
});

const query = `
  {
    birthdate
    openingNYSE
    instant
  }
`;

graphql(schema, query).then(result => {

    // Prints
    // {
    //   data: {
    //     birthdate: '1991-12-24',
    //     openingNYSE: '14:30:00.000Z',
    //     instant: '2017-01-10T21:33:15.233Z'
    //   }
    // }
    console.log(result);
});

Examples

This project includes several examples in the folder /examples explaining how to use the various scalars. You can also see some live editable examples on Launchpad:

Run the examples by downloading this project and running the following commands:

Install dependencies using yarn

yarn

Or npm

npm install

Run the examples

npm run examples

Scalars

This section provides a detailed description of each of the scalars.

A reference is made to coercion in the description below. For further clarification on the meaning of this term, please refer to the GraphQL spec.

Date

A date string, such as 2007-12-03, compliant with the full-date format outlined in section 5.6 of the RFC 3339 profile of the ISO 8601 standard for representation of dates and times using the Gregorian calendar.

This scalar is a description of the date, as used for birthdays for example. It cannot represent an instant on the time-line.

Result Coercion

Javascript Date instances are coerced to an RFC 3339 compliant date string. Invalid Date instances raise a field error.

Input Coercion

When expected as an input type, only RFC 3339 compliant date strings are accepted. All other input values raise a query error indicating an incorrect type.

Time

A time string at UTC, such as 10:15:30Z, compliant with the full-time format outlined in section 5.6 of the RFC 3339 profile of the ISO 8601 standard for representation of dates and times using the Gregorian calendar.

This scalar is a description of a time instant such as the opening bell of the New York Stock Exchange for example. It cannot represent an exact instant on the time-line.

This scalar ignores leap seconds (thereby assuming that a minute constitutes of 59 seconds), in this respect it diverges from the RFC 3339 profile.

Where an RFC 3339 compliant time string has a time-zone other than UTC, it is shifted to UTC. For example, the time string "14:10:20+01:00" is shifted to "13:10:20Z".

Result Coercion

Javascript Date instances are coerced to an RFC 3339 compliant time string by extracting the UTC time part. Invalid Date instances raise a field error.

Input Coercion

When expected as an input type, only RFC 3339 compliant time strings are accepted. All other input values raise a query error indicating an incorrect type.

DateTime

A date-time string at UTC, such as 2007-12-03T10:15:30Z, compliant with the date-time format outlined in section 5.6 of the RFC 3339 profile of the ISO 8601 standard for representation of dates and times using the Gregorian calendar.

This scalar is a description of an exact instant on the time-line such as the instant that a user account was created.

This scalar ignores leap seconds (thereby assuming that a minute constitutes of 59 seconds). In this respect it diverges from the RFC 3339 profile.

Where an RFC 3339 compliant date-time string has a time-zone other than UTC, it is shifted to UTC. For example, the date-time string "2016-01-01T14:10:20+01:00" is shifted to "2016-01-01T13:10:20Z".

Result Coercion

JavaScript Date instances and Unix timestamps (represented as 32-bit signed integers) are coerced to RFC 3339 compliant date-time strings. Invalid Date instances raise a field error.

Input Coercion

When expected as an input type, only RFC 3339 compliant date-time strings are accepted. All other input values raise a query error indicating an incorrect type.

graphql-iso-date's People

Contributors

aruberto avatar dandv avatar excitement-engineer avatar greenkeeper[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

graphql-iso-date's Issues

How to use with buildSchema?

How does one use this custom scalar if we're using buildSchema to build our schema, e.g.:

module.exports = buildSchema(`
  type User {
    id: ID!
    email: String!
    firstName: String!
    lastName: String!
    signupDate: DateTime!
  }

Unknown type "DateTime"

I just updated to Apollo Server 2.0 and I keep getting the following error whenever I run any query/mutation which uses the Date scalar type I've defined using graphql-iso-date:

Unknown type "DateTime". Did you mean "Date"?

resolvers.js

const { GraphQLDateTime } = require('graphql-iso-date')

const scalarResolvers = {
  Date: GraphQLDateTime
}

...

const resolvers = [scalarResolvers, exampleResolver1, exampleResolver2]

module.exports = mergeResolvers(resolvers)

types.js

const scalarTypes = gql`
	scalar Date
`

const typeDefs = [scalarTypes, exampleType1, exampleType2]

module.exports = mergeTypes(typeDefs)

Query type definition:

type Query {
	allUsers(
		limit: Int
		page: Int
		sort: String
		minDate: Date
		maxDate: Date
	): paginatedUsers
}

I get the error whenever I execute this:

query ($limit: Int!, $page: Int!, $sort: String!, $minDate: Date, $maxDate: Date) {
    allUsers(
      limit: $limit
      page: $page
      sort: $sort
      minDate: $minDate
      maxDate: $maxDate
    ) {
      docs {
        _id
		firstName
		lastName
		permanentAddress
		createdAt
      }
      total
      limit
      page
      pages
      prev
      next
    }
  }

Another weird thing is that on introspection, the schema in GraphQL Playground says minDate and maxDate are DateTime even though I've defined them as Date in my schema definition.

allUsers(
	limit: Int
	page: Int
	sort: String
	minDate: DateTime
	maxDate: DateTime
): paginatedUsers

Support coercing ISO8601 compatible strings in results

I'm receiving dates in the ISO8601 compatible format 2018-06-13T18:24:53.000+0000 from a database.
GraphQLDateTime from graphql-iso-date won't parse these strings into dates because of the lack of a colon in the timezone offset part.

I'm automatically creating resolvers and objects from a database schema (salesforce describe), and it's a bit hacky to test if i'm receiving a date field from the database and then convert from the 8601 string to a Date object or a 3339 string.

Ideally graphql-iso-date should also support the limited ISO8601 grammar as described in Appendix A of the ISO3339 RFC. This would allow for parsing most dates, without having to handle the full mess that is the ISO8601 format.

I'll probably open a pull request in a few days once I get some free time and see how big an undertaking this will be

"Error: Can't find type DateTime." when using internal values for enum

In my resolvers, I use something like:

const resolvers = {
  AllowedColor: {
    RED: '#f00',
    GREEN: '#0f0',
    BLUE: '#00f',
  }
};

(example taken from the Apollo Docs)

Unfortunately, adding these internal values results in an error:

C:...\node_modules\graphql-tools\dist\transforms\visitSchema.js:1
Error: Can't find type DateTime.

Everything works fine when using "regular" enums without internal values. On the other hand, the code above works as intended when graphql-iso-date isn't used.

I made this codesandbox, just uncomment the section with the enum resolver to see the problem in action.

Any ideas how to fix this issue?

Date format with +0000 isn't accepted

Hi,

I have dates in the format of 2019-12-18T04:41:32.428+0000 and I get the error DateTime cannot represent an invalid date-time-string 2019-12-18T04:41:32.428+0000.. I think this is a valid date however. Any idea why it doesn't like this?

DateTime does not recognize Iso DateTime string

I have datetime strings that are not recognized as a valid value, it throws following error:

found "2021-10-31T05:55:00+0000"; DateTime cannot represent an invalid date-time-string 2021-10-31T05:55:00+0000

If I add a colon it works: "2021-10-31T05:55:00+00:00"; Is it possible to add support for the non-colon datetime string as it is also a valid iso string?

GraphQLDate inputs cannot be delegated

If Service A has a mutation accepting a GraphQLDate input and it needs to delegate or forward that to another Service B with the same signature, the GraphQLDate yyyy-mm-dd string will be converted to a full DateTime string yyyy-mm-ddT00:00:00Z before arriving at Service B which fails validation.

For example, if the same mutation exists both in Service A and Service B, with A delegating the mutation to Service B:

Mutation {
  updateUser(input: UserInput!): User!
}

type User {
  id: ID!
  dob: GraphQLDate!
}

input UserInput {
  id: ID!
  dob: GraphQLDate!
}

And a client mutates Service A with the following

mutation updateUser($input: UserInput) {
  updateUser(input: $input) {
    id
    dob
  }
}

{
  "input": {
    "id": "1234",
    "dob": "2000-01-01"
  }
}

When service B receives the mutation, it will see the following as the input because it is being parsed to a JS Date object in service A:

{
  "input": {
    "id": "1234",
    "dob": "2000-01-01T00:00:00Z"
  }
}

Which fails validation.

You are already stripping the time component when serializing the GraphQL date. Can we do the same when parsing so that values can be passed from service to service?

Export flow type definitions

Export flow type definitions for the library so that people using flow will also be able to use in combination with this library.

Wrap errors with locatedError

Currently TypeErrors are thrown when parsing or serialization fails. I think these should be wrapped with locatedError.

This gives more insightful results:

{
  "errors": [{
    "message": "Variable \"$dateTime\" got invalid value {\"dateTime\":\"0\"}; Expected type DateTime at value.dateTime; DateTime cannot represent an invalid date-time-string 0.",
    "locations": [{
      "line": 2,
      "column": 11
    }]
  }]
}

Folks customizing formatError() will be able to identify the thrown exception as coming from the GraphQL layer, rather than being an exception thrown by resolver code. This is important to avoid leaking implementation errors, whilst still returning feedback to clients when they send incorrect values.

Would you take a PR that makes this change?

An in-range update of eslint-plugin-flowtype is breaking the build 🚨

Version 2.30.1 of eslint-plugin-flowtype just got published.

Branch Build failing 🚨
Dependency eslint-plugin-flowtype
Current Version 2.30.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As eslint-plugin-flowtype is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ


Status Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details
Commits

The new version differs by 10 commits (ahead by 10, behind by 2).

  • c2f959e 2.30.1
  • 2243076 fix: force release
  • 5de0277 chore: use babel-preset-env
  • 51ae588 refactor: use standard export syntax
  • e939596 fix: use semantic-release
  • 0f23196 chore: remove commitmsg linting
  • 751ac95 chore: release 2.30.0
  • def54e1 docs: update documentation
  • 1242ab4 fix: ensure colon is not null in typeColonSpacing reporter (#197)
  • 42ba3e4 docs: fix typo (#195)

See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Why does library discard UTC offsets?

Where an RFC 3339 compliant date-time string has a time-zone other than UTC, it is shifted to UTC. For example, the date-time string "2016-01-01T14:10:20+01:00" is shifted to "2016-01-01T13:10:20Z".

Would there be consideration to add a type that allows offsets?

Lack of trailing "Z" is invalid datetime?

Looks like the datetime regex rejects the following:

DateTime cannot represent an invalid date-time-string 2017-07-06T00:00:00.

...because there is no trailing "Z". Is that an accurate interpretation of the specification?

Here are some regexes in the wild that successfully match it:
http://jsfiddle.net/wq7tjec7/14/
https://www.myintervals.com/blog/2009/05/20/iso-8601-date-validation-that-doesnt-suck/
https://www.regextester.com/94925

Thanks for the package!

Queries with DateTime are too strict

I'm using DateTime in my model, but when I use simple date formats like '1-1-2020' in my queries, they fail validation. Why is that? The back-end date may contain both a date and a time, but like any other query language I want to be able to query these fields with simple date formats or with more specific DateTime formats. Why can't I query a DateTime with a Date?

I'm trying to figure out the best way to accomplish the above and having some trouble with it. Any advice?

Package is converting input UTC times before saving to database

graphql-iso-date version 3.6.1
graphql version 14.3.0

I input a UTC time string in graphql as "14:30:00Z", and it is returned correctly as "14:30:00.000Z", but in the mysql database the time is stored a few hours off according to my system timezone (10:30:00). Mysql is set to use UTC, so I am not sure why this is happening.

Parsing silently fails for mutations

Consider this example:

# Schema
type LogInput {
  message: String!
  createdAt: Date!
}

type Log {
  id: ID!
  message: String!
  createdAt: Date!
}

type Mutation {
  createLog(log: LogInput!): Log!
}

# query
mutation {
  createLog({
    message: "Hello, World!",
    createdAt: "2017-01-001" # invalid
  }) {
    message,
    createdAt
  }
}

In this example, parsing silently fails and sets the createdAt to null. I think it would be more useful to thrown an error in this case.

GraphQL 15 support

Is there any plan to support GraphQL 15 as the peer dependency goes up to ^14.0.0

32bit Int limitation issue

Hello,
There's a problem here when the number is more than 32bit and I believe it will be a problem in the future. Could you please fix this?

Time

Could you implement the same formats (including the time ones) that you propose in graphql/graphql-js#557 ?

This is a good foundation and a good interim solution, but it only covers date (without timezone) not time.

Thanks in advance

Newer versions of Flow causing issues with JSON.stringify

In newer versions of Flow (>=0.95) the types for JSON.stringify have been changed which is causing errors when using graphql-iso-date.

Error β”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆ node_modules/graphql-iso-date/dist/date/index.js.flow:48:11

Cannot add 'Date canno...' and JSON.stringify(...) because undefined [1] is incompatible with string [2].

     node_modules/graphql-iso-date/dist/date/index.js.flow
      44β”‚       )
      45β”‚     } else {
      46β”‚       throw new TypeError(
 [2]  47β”‚         'Date cannot represent a non string, or non Date type ' +
      48β”‚           JSON.stringify(value)
      49β”‚       )
      50β”‚     }
      51β”‚   },

     /private/tmp/flow/flowlib_2a9f9c93/core.js
 [1] 491β”‚     ): string | void;


Error β”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆ node_modules/graphql-iso-date/dist/date/index.js.flow:55:50

Cannot coerce JSON.stringify(...) to string because undefined [1] should not be coerced.

     node_modules/graphql-iso-date/dist/date/index.js.flow
      52β”‚   parseValue (value) {
      53β”‚     if (!(typeof value === 'string' || value instanceof String)) {
      54β”‚       throw new TypeError(
      55β”‚         `Date cannot represent non string type ${JSON.stringify(value)}`
      56β”‚       )
      57β”‚     }
      58β”‚

     /private/tmp/flow/flowlib_2a9f9c93/core.js
 [1] 491β”‚     ): string | void;


Error β”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆ node_modules/graphql-iso-date/dist/dateTime/index.js.flow:64:43

Cannot add 'DateTime c...' + 'non numeri...' and JSON.stringify(...) because undefined [1] is incompatible with
string [2].

     node_modules/graphql-iso-date/dist/dateTime/index.js.flow
      60β”‚       )
      61β”‚     } else {
      62β”‚       throw new TypeError(
 [2]  63β”‚         'DateTime cannot be serialized from a non string, ' +
      64β”‚         'non numeric or non Date type ' + JSON.stringify(value)
      65β”‚       )
      66β”‚     }
      67β”‚   },

     /private/tmp/flow/flowlib_2a9f9c93/core.js
 [1] 491β”‚     ): string | void;


Error β”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆ node_modules/graphql-iso-date/dist/dateTime/index.js.flow:71:54

Cannot coerce JSON.stringify(...) to string because undefined [1] should not be coerced.

     node_modules/graphql-iso-date/dist/dateTime/index.js.flow
      68β”‚   parseValue (value) {
      69β”‚     if (!(typeof value === 'string' || value instanceof String)) {
      70β”‚       throw new TypeError(
      71β”‚         `DateTime cannot represent non string type ${JSON.stringify(value)}`
      72β”‚       )
      73β”‚     }
      74β”‚

     /private/tmp/flow/flowlib_2a9f9c93/core.js
 [1] 491β”‚     ): string | void;


Error β”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆ node_modules/graphql-iso-date/dist/time/index.js.flow:55:31

Cannot add 'Time canno...' + 'or non Dat...' and JSON.stringify(...) because undefined [1] is incompatible with
string [2].

     node_modules/graphql-iso-date/dist/time/index.js.flow
      51β”‚       )
      52β”‚     } else {
      53β”‚       throw new TypeError(
 [2]  54β”‚         'Time cannot be serialized from a non string, ' +
      55β”‚         'or non Date type ' + JSON.stringify(value)
      56β”‚       )
      57β”‚     }
      58β”‚   },

     /private/tmp/flow/flowlib_2a9f9c93/core.js
 [1] 491β”‚     ): string | void;


Error β”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆβ”ˆ node_modules/graphql-iso-date/dist/time/index.js.flow:62:50

Cannot coerce JSON.stringify(...) to string because undefined [1] should not be coerced.

     node_modules/graphql-iso-date/dist/time/index.js.flow
      59β”‚   parseValue (value: mixed): Date {
      60β”‚     if (!(typeof value === 'string' || value instanceof String)) {
      61β”‚       throw new TypeError(
      62β”‚         `Time cannot represent non string type ${JSON.stringify(value)}`
      63β”‚       )
      64β”‚     }
      65β”‚

     /private/tmp/flow/flowlib_2a9f9c93/core.js
 [1] 491β”‚     ): string | void;



Found 6 errors

How do I return null in the resolver?

Returning null in the resolver for a nullable DateTime gives 1970-01-01T00:00:00.000Z

typeDefs = `
  type User {
    dob: DateTime
  }
`

resolvers = {
  User: {
    dob: () => null
  }
}

I would expect returning null to have the query response also be null instead of 1970-01-01T00:00:00.000Z

GraphQL 15 support

I just begin a tutorial with graphql that use your lib, they use [email protected] so I had to do npm i -force to install your lib since you don't allow GraphQL 15, is there a reason or will that be possible soon ?

mergeSchemas Error: Can't find type DateTime.

Hi,

i am getting bellow error can someone please help me. in typedef.graphql file i am using bellow

type TimestampType {
createdAt: DateTime
createdBy: ProfileType
modifiedAt: DateTime
modifiedBy: ProfileType
}

mergeSchemas.js:49
throw new Error("Can't find type " + name + ".");
^

Error: Can't find type DateTime.

Accept UNIX timestamp in milliseconds as a valid input

Seems odd that ES native expression of time (UNIX timestamp in milliseconds) is not supported as a valid input; only the truncated (seconds) format is accepted. This requires a superfluous new Date(timestamp) wrapper.

How can I use graphql-iso-date with graphql-tag?

eg I have a type E with following statements

const GraphqlISODate  = require('graphql-iso-date');
const {GraphQLDate} = GraphqlISODate;

module.exports = gql`
type E {
 ... 
 purchaseDate: GraphQLDate
}
`

But I got error with GraphQLDate not found, how can I resolved it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.