GraphQL scalars for Date, DateTime, and Time formats in compliance with ISO 8601 (YYYY-MM-DD, YYYY-MM-DDTHH:MM:SSZ, HH:MM:SSZ). Version 0.2.0 supports both GraphQL v15 and v16, ships TypeScript definitions, and requires Node >=14. Unlike graphql-iso-date (deprecated library this was forked from), this package uses plain resolvers instead of GraphQL scalar interface, making it simpler to integrate. It provides parse/serialize methods for direct usage outside of GraphQL resolvers. Release cadence is ad-hoc with no recent updates.
npm install graphql-date-scalarsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Basic Apollo Server setup with Date, Time, and DateTime scalar types using graphql-date-scalars.
Use import syntax or switch to dynamic import().
Validate date strings before passing them to parseValue. Use a library like 'date-fns' for strict parsing.
If migrating from graphql-iso-date, replace { GraphQLDate } with { DateScalar } and use it directly as a resolver.Upgrade graphql dependency to ^15.0.0 || ^16.0.0.
Change to import statement: import { DateTimeScalar } from 'graphql-date-scalars'Use DateScalar directly in resolvers: resolvers: { Date: DateScalar }Ensure date strings are valid ISO 8601 (e.g., '2023-01-15T10:30:00Z').