graphql-composer
Version:
Create your GraphQL API using composition!
27 lines • 751 B
JavaScript
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
;