F
Filament15mo 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
Homd15mo 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
HugoOP15mo ago
This is also the alternative I've found for the moment, thank you !
Want results from more Discord servers?
Add your server