F
Filament16mo ago
Hugo

How to make a YearPicker ?

Hi, I'm trying to make a DatePicker to select only years, how i can do that ?
Forms\Components\DatePicker::make('year')
->native(false)
->format('YYYY')
->label('Année')
->required(),
Forms\Components\DatePicker::make('year')
->native(false)
->format('YYYY')
->label('Année')
->required(),
Thanks for your help
2 Replies
Homd
Homd16mo ago
I think you need to create custom field for that. HTML doesn't provide year picker out of the box. or just create select with custom option
Select::make('status')
->options([
//Your code here to generate year
])
Select::make('status')
->options([
//Your code here to generate year
])
Hugo
HugoOP16mo ago
This is also the alternative I've found for the moment, thank you !

Did you find this page helpful?