Open vsuaste opened 4 years ago
It appears the library we use is buggy. I don't see where adding a date to a time is correct behavior. As the new repository is doing the same, let's not use that either. Luckily it seems to be easy to define and implement home rolled scalar types like Date, DateTime, Time, Aliens
Look at these resources:
We implement our own Date, DateTime, and Time scalars. We need to take into account AJV validation (see above).
For now remove Time
from our global schema, because it appears wrong (to @asishallab) that a ISO-Time is converted to an instance with a Date. The latter actually causes trouble when being fed into Sequelize.
GraphqlTime type from
graphql-iso-date
is not compatible with Sequelize time type. The problem is that when graphql parses a time type it actually creates a Date with the current day and the time provided by the user. The following code is taken from the graphql-iso-date libraryWhen we pass to sequelize a time already parsed by graphql, then it will throw an error like this one:
And the error is because Sequelize expects only to receive a time type such as
10:15:30Z
. The curious thing is that the same happens for Date type, graphql parses and automatically add the time extra info, but sequelize is capable to extract only the Date.