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
Using GraphQL::Types::ISO8601Date on a custom type's field can produce an invalid_date error when renderer if the field is a Date object set to 2024-02-29.
After analysis, it appears that value.to_s output Tue 29th Feb., and Date.parse(value.to_s) crash with an invalid_date error because the year is not present in the input argument (which is necessary for leap days).
Versions
graphql version: '~> 2.3' rails (or other framework): '6.1.7.10'
GraphQL schema
Include relevant types and fields (in Ruby is best, in GraphQL IDL is ok). Any custom extensions, etc?
My bad, it's my fault for not noticing this. But it still make the ISO8601Date type a bit problematic for those that replace the default Date::to_s format.
I understand it's an edge case, but I think maybe you could use the same logic as ISO8601DateTime which seems more reliable by reusing the Date object directly without relying on string parsing?
Describe the bug
Using
GraphQL::Types::ISO8601Date
on a custom type's field can produce aninvalid_date
error when renderer if the field is aDate
object set to2024-02-29
.After analysis, it appears that
value.to_s
outputTue 29th Feb.
, andDate.parse(value.to_s)
crash with aninvalid_date
error because the year is not present in the input argument (which is necessary for leap days).Versions
graphql
version: '~> 2.3'rails
(or other framework): '6.1.7.10'GraphQL schema
Include relevant types and fields (in Ruby is best, in GraphQL IDL is ok). Any custom extensions, etc?
GraphQL query
Example GraphQL query and response (if query execution is involved)
Steps to reproduce
GraphQL::Types::ISO8601Date
fieldDate
object with the date field. The date should be on a leap day (ie.Date.new(2024, 2, 29)
)Expected behavior
2024-02-29
)Actual behavior
invalid_date
The text was updated successfully, but these errors were encountered: