ariaieboy / filament-jalali-datetimepicker

a Drop-in Jalali Replacement for filament DateTimePicker
MIT License
23 stars 1 forks source link

format() function not working in forms with filament v3 #17

Closed msalehipro closed 11 months ago

msalehipro commented 11 months ago

Hi there, I'm using JalaliDatePicker with Filament V3 and i want to use custom format for DatePicker in my form but it has no effect on field. Here is my code :

DatePicker::make('start_date')
                    ->label('تاریخ ورود')
                    ->jalali()
                    ->format('Y-m-d')
                    ->required(),
ariaieboy commented 11 months ago

You are using the wrong function to format the display date. the function that you used change the format that will saves in database to change the display format you must use displayFormat method: https://filamentphp.com/docs/3.x/forms/fields/date-time-picker#customizing-the-display-format