F
Filament2y ago
as0t

Datepicker date format

I am trying to format the date using format() method from Datepicker form component but did not worked. my code:
DatePicker::make('due_date')
->required()
->displayFormat('d/m/Y')
->format('d/m/Y')
DatePicker::make('due_date')
->required()
->displayFormat('d/m/Y')
->format('d/m/Y')
No description
5 Replies
toeknee
toeknee2y ago
try: ->native(false) does it make a difference
as0t
as0tOP2y ago
thanks, it worked. I had tried before with native(false) but i was not using the displayFormat method with it a bit annoying native don't work with format
toeknee
toeknee2y ago
native is the browsers method you see, that's why
as0t
as0tOP2y ago
yes, thanks! got it, saw in documentation the example
DatePicker::make('date_of_birth')
->native(false)
->displayFormat('d/m/Y')
DatePicker::make('date_of_birth')
->native(false)
->displayFormat('d/m/Y')
but didn't noticed that i need the native(false), perhaps documentation should explicit this
toeknee
toeknee2y ago
Please feel free to do a PR 🙂

Did you find this page helpful?