UNPKG

626 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.GraphQLISODateTime = void 0;
4const graphql_1 = require("graphql");
5exports.GraphQLISODateTime = new graphql_1.GraphQLScalarType({
6 name: 'DateTime',
7 description: 'A date-time string at UTC, such as 2019-12-03T09:54:33Z, compliant with the date-time format.',
8 parseValue(value) {
9 return new Date(value);
10 },
11 serialize(value) {
12 return value instanceof Date ? value.toISOString() : null;
13 },
14 parseLiteral(ast) {
15 return ast.kind === graphql_1.Kind.STRING ? new Date(ast.value) : null;
16 },
17});