malzariey / filament-daterangepicker-filter

MIT License
79 stars 39 forks source link

Undesirable behavior on DateRangePicker #68

Closed lepresk closed 3 months ago

lepresk commented 3 months ago

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

malzariey commented 3 months ago

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

lepresk commented 3 months ago

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'),