Laravel-Backpack / community-forum

A workspace to discuss improvement and feature ideas, before they're actually implemented.
28 stars 0 forks source link

[Bug] calendar-operation - Invalid datetime format: 1292 when an event is moved #1072

Closed AndreNeny closed 1 month ago

AndreNeny commented 2 months ago

Bug report

not sure it's a bug ...

What I did

I installed the premium components devtools, calendar-operation, editable-columns, with l11 and backpack. app.php: 'timezone' => 'UTC', 'locale' => 'fr', crud.php: 'fr' => 'French'.

Events are nicely showed. But when I move an event ...

What I expected to happen

event updated.

What happened

the sql update order causes error : SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: '2024-07-04T22:00:00.000Z' for column 'start' at row 1 (Connection: mysql, SQL: update planifications set start = 2024-07-04T22:00:00.000Z, end = 2024-07-05T07:00:00.000Z, planifications.updated_at = 2024-07-08 15:30:13 where id = 4)

What I've already tried to fix it

I deactivated debugbar. no effect.

I modified locale in app.php and crud.php. no effect

Is it a bug in the latest version of Backpack?

After I run composer update backpack/crud the bug... is it still there?

yes.

Backpack, Laravel, PHP, DB version

Backpack 6 Laravel: 11.14.0 PHP: 8.3.7 MySQL: 8.0.30

When I run php artisan backpack:version the output is: backpack/basset: 1.3.4 backpack/calendar-operation: 1.0.5 backpack/crud: 6.7.17 backpack/devtools: 3.1.5 backpack/editable-columns: 3.0.9 backpack/filemanager: 3.0.8 backpack/generators: v4.0.5 backpack/logmanager: v5.0.2 backpack/permissionmanager: 7.2.1 backpack/pro: 2.2.4 backpack/settings: 3.1.1 backpack/theme-coreuiv2: 1.2.4 backpack/theme-tabler: 1.2.10

karandatwani92 commented 1 month ago

Hey @AndreNeny

I'm unable to reproduce the error. Can you refer to demo's Meeting Model & MeetingCrudController to figure out the issue?

Let me know, if you continue to face the issue.

AndreNeny commented 1 month ago

Hi, Thank's for your reply. I did the test with your model and your controller. The result is the same. I will test with a new Laravel server and I will keep you informed. But it's not one of my priorities.

bests regards, André Nény

Le jeu. 11 juil. 2024 à 14:36, Karan Datwani @.***> a écrit :

Hey @AndreNeny https://github.com/AndreNeny

I'm unable to reproduce the error. Can you take reference from our demo's Meeting https://github.com/Laravel-Backpack/demo/blob/main/app/Models/Meeting.php Model & MeetingCrudController https://github.com/Laravel-Backpack/demo/blob/main/app/Http/Controllers/Admin/MeetingCrudController.php to figure out the issue.

Let me know, if you continue to face the issue.

— Reply to this email directly, view it on GitHub https://github.com/Laravel-Backpack/community-forum/issues/1072#issuecomment-2222824071, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKHAHYVLSMO53BBO2CZQS53ZLZ35LAVCNFSM6AAAAABKRE26O2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRSHAZDIMBXGE . You are receiving this because you were mentioned.Message ID: @.***>

AndreNeny commented 1 month ago

Hi, Not closed for me. The same with a new install of Laravel 10. To transform start and end dates before update in database, I'hd write a middleware that is ok, but now, no call to the database for update. My route : Route::post('admin/planification/calendar/entry/{id}', 'App\Http\Controllers\Admin\PlanificationCrudController@update')->middleware('convertDateFormat'); ==> the dates are correctly converted, but I get a 404 error on POST http://localhost/admin/planification/calendar/entry/8 I had tried with Route::post('admin/planification/calendar/entry/{id}', 'App\Http\Controllers\Admin\PlanificationCrudController@update')->middleware(['convertDateFormat','admin']); same error.

Thank's for your attention. a.n.

karandatwani92 commented 1 month ago

Hey @AndreNeny

Calendar operation does not require any custom middleware to work. Can you share your model & CRUDcontroller to find the issue?

AndreNeny commented 1 week ago

Hey karan, For your information, for lack of another solution, I made my code work with ConvertDateFormat middleware. Thank's for your attention.