Single entry from DatePicker or DateTimePicker
Is it possible to select only one field from DatePicker or DateTimePicker like only month or only year?
6 Replies
Hi @ranamoizhaider , can you describe the behavior you are looking for? What do you want to see/click in the datepicker, and what do you want to appear in the text input?
I am generating a challan and I have a field named
challan_for
this field will only have the value of month. Now one approach that I can go with is:
I was asking is there any way to select only month or month and year from datepicker (I mean without selecting date). Like we open and only this appears(image attached).Maybe something like:
I see, thanks for the details! I don't think this is possible with the DatePicker field but, on the other hand, it would be pretty simple to use 2 Select fields. How are you saving this info in the database?
I was trying to save it as a string. Now I have changed it to two select fields as you suggested challan_month and challan_year and using two select fields. Both of these are strings.
You can do it with FlatPickr Plugin: https://filamentphp.com/plugins/coolsam-flatpickr . But I'm having some issues with it right now
Filament
Flatpickr by Sam Maosa - Filament
Use Flatpickr as your datepicker in the Filament Forms and Panels