DatePicker not disabling dates outside of min and max dates
I have the following code to create a
DatePicker
for Table Filter
but the dates outside of min and max dates don't seem to be disabled. Am I missing something here?Solution:Jump to solution
POC:
```php
Forms\Components\DatePicker::make('poc_date')
->minDate(now()->startOfMonth()->addDay())
->maxDate(now()->endOfMonth()->subDay())...
13 Replies
I believe min and max are just for validation. Try ->disabledDates()
ah ok
It accepts an array of dates or a closure
can't disabled all dates except a few with that if I am right. :). Not sure what the closure would be..
Actually, try using minDate and maxDate but with ->native(false)
Disabling specific dates
That only does a few dates,
->native(false)
should do what he wantsI actually want the opposite, I only want few dates enabled and the rest disabled..
Yes, so use your original code but add
->native(false)
. That’ll disable everything before/after those dates
You can then use ->disabledDates()
along with that if you want to disable weekends, or holidays or something like that
(Also, in your original code you are setting minDate twice)Solution
POC:
will get you this:
thank you. that worked