malzariey/filament-daterangepicker-filter

Undesirable behavior on DateRangePicker

Closed this issue · 2 comments

After selecting a date, the DateRangerPicker component automatically adds the time to the input (see screenshot). This was not the case before version 2.5.2.

If this is how it normally works, how can you display only the date without the time ?

My code

DateRangePicker::make('period')
    ->default(sprintf(
       "%s - %s",
        now()->startOfMonth()->subDays(30)->format('d/m/Y'),
        now()->startOfMonth()->format('d/m/Y'),
      ))
     ->label('Période'),

Capture d'écran 2024-04-13 193523

Issue fixed with latest version, you can also use the displayformat to change the format

Setting de displayFormat help to fix the issue :

DateRangePicker::make('period')
    ->displayFormat("DD/MM/YYYY")
    ->default(sprintf(
        "%s - %s",
        now()->startOfMonth()->subDays(30)->format('d/m/Y'),
        now()->startOfMonth()->format('d/m/Y'),
))
->label('Période'),