I am trying to send a mutation to my graphql server to update a date. My mutation schema looks like this:
mutation CreateReminderMutation(
$birthday: Date
) {
createReminder(
birthday: $birthday
) {
id
}
}
Then in my react component I am sending the date like this using moment
.
const Calendar = () => {
// component and mutation implementation
birthday: moment(birthday).toDate()
}
I am getting the following error message:
[GraphQL error]: Message: Variable "$birthday" got invalid value "2019-03-15T12:00:00.000Z"; Expected type Date; Value is not a valid Date: 2019-03-15T12:00:00.000Z, unparsable, Location: [object Object], Path: undefined
can anyone advise how to get the correct Date
format with moment to send to graphql?