DateTimePicker: Error - Invalid datetime format

Hi, I have column "payment_due_at" , $table->dateTime('payment_due_at')->nullable(); My form:
Forms\Components\DateTimePicker::make('payment_due_at')
->displayFormat('M j, Y')
->format('Y-m-d h:m:s')
->maxDate(now()->addDays(90)),
Forms\Components\DateTimePicker::make('payment_due_at')
->displayFormat('M j, Y')
->format('Y-m-d h:m:s')
->maxDate(now()->addDays(90)),
When submitting I get: SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: '1690542420' for column 'payment_due_at' at row 1 I have also tried:
Forms\Components\DateTimePicker::make('payment_due_at')
->displayFormat('M j, Y')
->maxDate(now()->addDays(90)),
Forms\Components\DateTimePicker::make('payment_due_at')
->displayFormat('M j, Y')
->maxDate(now()->addDays(90)),
Same error Any suggestions, please? Thank you
Solution:
Do you have a datetime cast on the model?
Jump to solution
3 Replies
Solution
Patrick Boivin
Patrick Boivin17mo ago
Do you have a datetime cast on the model?
Pablo Torres
Pablo TorresOP17mo ago
Correct, thanks... I just add the cast, it works now.
Want results from more Discord servers?
Add your server