Datepicker disable weekends

Hi, has anyone been able to disable only weekends on the Datepicker component?
2 Replies
Mikazor
Mikazor2y ago
There are an option https://filamentphp.com/docs/3.x/forms/fields/date-time-picker#disabling-specific-dates
use Filament\Forms\Components\DateTimePicker;

DateTimePicker::make('date')
->native(false)
->disabledDates(['2000-01-03', '2000-01-15', '2000-01-20'])
use Filament\Forms\Components\DateTimePicker;

DateTimePicker::make('date')
->native(false)
->disabledDates(['2000-01-03', '2000-01-15', '2000-01-20'])
Juan
Juan2mo ago
I use this: ->disabledDates(function () { $start = Carbon::now()->startOfMonth(); $end = $start->copy()->endOfMonth(); $period = CarbonPeriod::create($start, $end); $weekends = []; foreach ($period as $date) { if ($date->isWeekend()) { $weekends[] = $date; } } return $weekends;

Did you find this page helpful?