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