UNPKG

graphql-composer

Version:
27 lines 751 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DateTime = void 0; const graphql_1 = require("graphql"); /** * Represents an ISO date */ exports.DateTime = new graphql_1.GraphQLScalarType({ name: "DateTime", description: "The javascript `Date` as string. Type represents date and time as the ISO Date string.", parseValue(value) { return new Date(value); }, serialize(value) { if (value instanceof Date) { return value.toISOString(); } return null; }, parseLiteral(ast) { if (ast.kind === graphql_1.Kind.STRING) { return new Date(ast.value); } return null; }, }); //# sourceMappingURL=DateTime.js.map