Datetimepicker ignore
Forms\Components\DateTimePicker::make('inclusive_start_date')
->label('Start Date/Time')
->default(now())
->minDate(now())
->required()
->live()
how can I ignore minDate when I am just editing something?
4 Replies
What do you mean?, minDate is a validation on the html side. Why would you want to turn off a validation?
If the validation can be overridden then there’s no point in the validation in the first place.
awcodes has a point.
However, I can see where an Admin might legitimately be allowed to enter a "past" date whereas a non-admin must not enter something prior to "now()".
So, like most things in Filament, you could pass a closure to it, which returns different minimums based on certain criteria.
Fair. In that case though, I feel it would be safer to use a custom rule and use that in the rules array instead of using minDate(). 🙂
Anything depending on authorization should be handled by the back end and not the frontend. IMHO.
it works fine on creating, but when i do edit something from that particular data, it is being validated. Thus, stopping me from editing the data, and in order to make it work, i have to update the date.
i was hoping for like ignoreRecord:true or similar
will try your solutions, thank you!!!