cloudcake / laravel-approval

Attach an approval process to any model, approve and disapprove from any other model, for Laravel.
MIT License
140 stars 15 forks source link

Approval for date Modifications gives invalid datetime format #8

Closed Mohmdthabet closed 4 years ago

Mohmdthabet commented 4 years ago

Although timestamp is not modified, Laravel Approval saves a modification in carbon date field in this format: {"expiry_date":{"original":"2019-08-22 00:00:00","modified":"2019-08-22T00:00:00.000000Z"}}

When i tried to approve the modification it gives the following message:

SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: '2019-08-22T00:00:00.000000Z' for columnbris.policies.expiry_dateat row 1 (SQL: updatepoliciessetexpiry_date= 2019-08-22T00:00:00.000000Z whereid= 1)

the timezone settings in app/config is: 'timezone' => 'UTC',

Mohmdthabet commented 4 years ago

The Issue is in Carbon date formatting. I used this code to parse the date from the form: $value = Carbon::parse($value); When Updated to this: $value = Carbon::parse($value)->format('Y-m-d H:i:s');

The issue is resolved.