Parse string into Date type #807
-
|
I'm wrapping a REST API into a GraphQL endpoint. The REST API returns a My schema: @ObjectType()
class Widget {
@Field(() => Date)
updatedAt: string
}How should I get GraphQL to parse the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
|
Beta Was this translation helpful? Give feedback.
DateisDate, the JSnew Date().If you want to treat string as date, just do
@Field(() => String)or find another GraphQL scalar that accepts strings and numbers as a valid date value.JSON is not capable of transporting
Datetype, it has to be serialized.