I am using vuejs-datepicker and inertiajs, but when I try to update the database I am getting the error: Invalid datetime format: 1292 Incorrect date value: '2021-07-09T12:54:00.000Z' for column 'date_of_birth'
I tried formatting the date within the controller, but this doesn't save anything. What am I missing here?
eidt.vue:
<datepicker v-model="form.date_of_birth" name="Date of birth" />
data() {
return {
form: this.$inertia.form({
_method: 'put',
date_of_birth: this.application.date_of_birth,
}),
}
},
methods: {
update() {
this.form.put(this.route('applications.update', this.application.id))
},
},
controller/applications.update:
User::find($application->user_id)->update(Request::only(
['date_of_birth' => date('Y-m-d H:i:s', $application->user->date_of_birth)],
));