malzariey / filament-daterangepicker-filter

MIT License
79 stars 39 forks source link

defaultToday() , startDate(), endDate() fail when format is "m/d/Y" #76

Closed ronfuller closed 2 months ago

ronfuller commented 2 months ago

In the DateRangeFilter the call to getFormSchema() needs to call displayFormat() and format() earlier in the call chain to estabilsh the default format

Current code , DateRangeFilter.php

public function getFormSchema(): array {
...
   return [
       DateRangePicker::make($this->column)
        ->hiddenLabel($this->isLabelHidden)
        ...
        ...
        ->displayFormat($this->displayFormat)
        ->format($this->format)
        ...
        ];
...

Move the call to format() and displayFormat() to the top of the chain and the code works correclty