webiny-js
webiny-js copied to clipboard
Unable to query headless CMS using valid ISO 8601 date
trafficstars
Version
5.37.5
Operating System
n/a
Browser
n/a
What are the steps to reproduce this bug?
- Create a headless CMS model
- Add a Date/Time field, and set the format to Date and time with timezone
- Create a new instance of the field
- Send a request for the model with a variable in ISO 8601 format with a time offset of
Z
What is the expected behavior?
The request is processed successfully.
What do you see instead?
An error:
Variable "$date" got invalid value "2023-10-06T15:30:39.548Z"; Expected type "DateTimeZ". Could not extract timezone from value.
Additional information
No response
Possible solution
https://github.com/webiny/webiny-js/blob/3bd39d50bc5855ea008f443e654a7975aeb79184/packages/handler-graphql/src/builtInTypes/DateTimeZScalar.ts#L5-L38
- Add support for 'Z' as a time offset
- Alternatively, the whole function may be able to be dropped since the
graphql-scalarspackages is being used as a validator