Thanks. This is exactly what I get when I log what...
# orm-help
d
Thanks. This is exactly what I get when I log what’s returned from the DatePicker (followed by its type)
2018-07-31T14:02:15.539Z object
I guess, as you said, I can use toISOString() to get what I want. Providing this works then, the type of dateOfBirth in my Apollo mutation would be “string” and the type received in the resolver can be DateTime, right?
g
Correct
d
Thanks. I’ll give that a go.
So, I used toISOString to make the date a string (in the app) and pass it via the mutation. There was still an error (a cryptic 400) but I managed to get it working. What I had (on the server) was: datamodel.graphql
Copy code
type User @ model {
  …
  dateOfBirth: DateTime
}
schema.graphql
Copy code
type Mutation {
  updateUser {
    ...
    dateOfBirth: Datetime
  }
}
By changing the second (in schema.graphql) to String, it worked.
I made the mistake of thinking DateTime could also be used in schema.graphql as well as the datamodel.
Actually, after changing that to String (in schema.graphql) I don’t even need to use to ISOString (as you originally thought). 🙂
@Anthony Fadale ^
🙂