You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to ensure type safety in the Angular project I'm working on. In the codegen.ts file, adding this appears to work at first glance:
config: { scalars: { DateTime: "Date" } }
The generated scalar looks like this:
DateTime: { input: Date; output: Date; }
This seems to work fine for the input, however the output does not behave as I would expect. When I inspect the value of a property that was assigned to this scalar in Chrome's devtools it is very clearly a string:
This becomes a problem when the data is added to a primeng table, as the built in filtering mechanism will not work with a string and I'm having to convert each one to a date before filtering will work. Is there any way to truly force outputs from a graphql API to be Date objects instead of strings?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Trying to ensure type safety in the Angular project I'm working on. In the codegen.ts file, adding this appears to work at first glance:
config: { scalars: { DateTime: "Date" } }
The generated scalar looks like this:
DateTime: { input: Date; output: Date; }
This seems to work fine for the input, however the output does not behave as I would expect. When I inspect the value of a property that was assigned to this scalar in Chrome's devtools it is very clearly a string:
This becomes a problem when the data is added to a primeng table, as the built in filtering mechanism will not work with a string and I'm having to convert each one to a date before filtering will work. Is there any way to truly force outputs from a graphql API to be Date objects instead of strings?
Beta Was this translation helpful? Give feedback.
All reactions