FilamentF
Filament2y ago
Azka

6 digits in year usingDateTimePicker & DatePicker

When entering the date by typing on the keyboard, i can enter 202407 before it jumps over to the month "section" of the field. Anyone knows how to solve this?

Here is an example of the code:
Forms\Components\DateTimePicker::make('ends_at')
                ->required()
                ->hidden(fn (Forms\Get $get) => $get('is_all_day'))
                ->seconds(false)
                ->format('Y-m-d H:i')
                ->displayFormat('Y-m-d H:i'),
            Forms\Components\DatePicker::make('date')
                ->required()
                ->visible(fn (Forms\Get $get) => $get('is_all_day'))
                ->format('Y-m-d')
                ->displayFormat('Y-m-d'),
`
Solution
Thanks alot, that solved it.

For others looking for the solution, here is how i added it:
With DateTimePicker
->maxDate('9999-12-31T23:59')
and with DatePicker:
->maxDate('9999-12-31')
Was this page helpful?