Possibility to have nullable datepicker?
I have a 'Date of Death' field that should be nullable. Currently, the DatePicker defaults to the current date, and users have to clear it every time before saving. Is there a way to modify this behavior?
Solution:Jump to solution
Ok, got it. It's older project and I'm using carbon mutator, when it gets "null" value to parse, it will return current date, that's what I see on edit page. Thanks for pointing me to right way.
4 Replies
By default the datepicker is empty.
Is it possible that you have a default date on the migration ?
If not, can you share the code of your migration field and the datepicker?
Inside DB is also NULL value
Forms\Components\DatePicker::make('death_date')->label('Death date'),
$table->date('death_date')->nullable(),
Is this on creating a new record or updating a record?
Because if i create a new record my default date in the form is empty only a mask of "dd/mm/yyyy".
Solution
Ok, got it. It's older project and I'm using carbon mutator, when it gets "null" value to parse, it will return current date, that's what I see on edit page. Thanks for pointing me to right way.