Open simplenotezy opened 1 week ago
I got away with this in the resolver:
DateTime: new GraphQLScalarType({
name: 'DateTime',
description: 'A valid date-time value',
parseValue(value: any) {
return new Date(value); // value from the client input variables
},
serialize(value: any) {
return value.toISOString(); // value sent to the client
},
parseLiteral(ast) {
if (ast.kind === Kind.STRING) {
return new Date(ast.value); // value from the client query
}
return null;
},
}),
Remember to add graphql
to your package json.
How can we go about creating custom scalar resolvers, e.g. for a DateTime scalar?