How do I ignore the minDate() validation if its the default value?
This is an infolist action which it has a a form inside. Now in my date picker the behavior is that the minimum date to be selected is the current date but the default value is example the old date like
November 6, 2023
November 6, 2023
. I just want to ignore the validation since I don't want to change the date. Can someone help me with this?
Infolists\Components\Actions\Action::make('edit_purpose') ->label('Edit Purpose') ->icon('heroicon-m-pencil-square') ->modalIcon('heroicon-s-pencil-square') ->modalDescription('Edit the purpose of the program.') ->modalSubmitActionLabel('Save Changes') ->form([ Forms\Components\DatePicker::make('desired_pentesting_date') ->label('What is the desired start date for penetration testing?') ->placeholder('Select a Desired Start Date') ->required() ->native(false) ->minDate(now()->startOfDay()) // want to have the minimum date behavior but ignore if the default value is not change ->prefix('Starts') ->suffix('at midnight') ->closeOnDateSelection() ->default(fn ($record) => $record->purpose->desired_start_date_at) ->validationAttribute('desired pentesting date'), ]) ->stickyModalHeader() ->stickyModalFooter() ->action(function (array $data) { dd($data); });
Infolists\Components\Actions\Action::make('edit_purpose') ->label('Edit Purpose') ->icon('heroicon-m-pencil-square') ->modalIcon('heroicon-s-pencil-square') ->modalDescription('Edit the purpose of the program.') ->modalSubmitActionLabel('Save Changes') ->form([ Forms\Components\DatePicker::make('desired_pentesting_date') ->label('What is the desired start date for penetration testing?') ->placeholder('Select a Desired Start Date') ->required() ->native(false) ->minDate(now()->startOfDay()) // want to have the minimum date behavior but ignore if the default value is not change ->prefix('Starts') ->suffix('at midnight') ->closeOnDateSelection() ->default(fn ($record) => $record->purpose->desired_start_date_at) ->validationAttribute('desired pentesting date'), ]) ->stickyModalHeader() ->stickyModalFooter() ->action(function (array $data) { dd($data); });