{"id":47852,"library":"graphql-date","title":"graphql-date","description":"A GraphQL custom scalar type for Date values. Version 1.0.3 is the current stable release. The package provides a simple GraphQLDate scalar that serializes, parses, and validates date strings. It is widely used in GraphQL schemas to handle dates, but is not actively maintained. Alternatives include using graphql-iso-date or the built-in graphql@14+ Date scalar.","status":"maintenance","version":"1.0.3","language":"javascript","source_language":"en","source_url":"https://github.com/tjmehta/graphql-date","tags":["javascript","graphql","date","type","datetype"],"install":[{"cmd":"npm install graphql-date","lang":"bash","label":"npm"},{"cmd":"yarn add graphql-date","lang":"bash","label":"yarn"},{"cmd":"pnpm add graphql-date","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency for GraphQL type system integration","package":"graphql","optional":false}],"imports":[{"note":"Package only provides CommonJS export; default import syntax may fail in ESM environments.","wrong":"import GraphQLDate from 'graphql-date'","symbol":"GraphQLDate","correct":"const GraphQLDate = require('graphql-date')"},{"note":"The package uses module.exports = GraphQLDate, not a named export. Use default import.","wrong":"import { GraphQLDate } from 'graphql-date'","symbol":"GraphQLDate","correct":"import GraphQLDate from 'graphql-date'"},{"note":"If using TypeScript with esModuleInterop, this may be required in some configurations.","wrong":"const GraphQLDate = require('graphql-date')","symbol":"GraphQLDate","correct":"const GraphQLDate = require('graphql-date').default"}],"quickstart":{"code":"const { GraphQLObjectType, GraphQLSchema, graphql } = require('graphql');\nconst GraphQLDate = require('graphql-date');\n\nconst schema = new GraphQLSchema({\n  query: new GraphQLObjectType({\n    name: 'Query',\n    fields: {\n      today: {\n        type: GraphQLDate,\n        resolve: () => new Date().toISOString()\n      }\n    }\n  })\n});\n\ngraphql(schema, '{ today }').then(result => {\n  console.log(result);\n});","lang":"javascript","description":"Shows creating a GraphQL schema with a date field and querying it."},"warnings":[{"fix":"Switch to graphql-iso-date or use GraphQLDate from graphql@14+.","message":"graphql-date is not actively maintained. Consider using graphql-iso-date or the built-in GraphQL Date scalar provided by graphql@14+.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Use CommonJS require() or ensure your build pipeline handles CJS to ESM conversion.","message":"The package does not support ESM imports. Using import syntax may cause errors in Node.js or bundlers unless transpiled.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Always format dates as ISO 8601 strings before returning in resolvers.","message":"GraphQLDate only accepts ISO 8601 date strings. Other date formats (e.g., Unix timestamps) will cause serialization errors.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use a library like graphql-iso-date which supports timezone-aware types.","message":"graphql-date does not handle timezones. All dates are treated as UTC.","severity":"deprecated","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.0.3':13 '14':61 'activ':46 'altern':48 'built':58 'built-in':57 'current':16 'custom':6 'date':3,10,31,42,54,62,66 'datetyp':68 'graphql':2,5,38,52,60,65 'graphql-dat':1 'graphql-iso-d':51 'graphqldat':24 'handl':41 'includ':49 'iso':53 'javascript':64 'maintain':47 'packag':20 'pars':28 'provid':21 'releas':18 'scalar':7,25,63 'schema':39 'serial':27 'simpl':23 'stabl':17 'string':32 'type':8,67 'use':36,50 'valid':30 'valu':11 'version':12 'wide':35","created_at":"2026-06-07T16:53:39.250935+00:00","updated_at":"2026-06-07T16:53:39.250935+00:00","problems":[{"fix":"Install graphql: npm install graphql","cause":"Attempting to use GraphQLDate without requiring graphql as a peer dependency.","error":"TypeError: Cannot read property 'name' of undefined"},{"fix":"Use require() instead: const GraphQLDate = require('graphql-date');","cause":"Using ES module import syntax in a Node.js environment without transpilation or type: module.","error":"SyntaxError: Unexpected token 'export'"},{"fix":"Ensure you return a valid ISO string or a Date object. For example: resolve: () => new Date().toISOString()","cause":"The resolver returned a string instead of a Date object, or the string format is not valid ISO 8601.","error":"Expected a value of type \"Date\" but received: \"2023-01-01T00:00:00.000Z\""}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/tjmehta/graphql-date","github":"https://github.com/tjmehta/graphql-date","docs":null,"changelog":null,"pypi":null,"npm":"graphql-date","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}