LowerRockLabs / LaravelLivewireTablesAdvancedFilters

Advanced filters for Rappasoft Laravel Livewire Tables
8 stars 0 forks source link

DateRangeFilter showing current date as placeholder causes confusion #74

Open BenOussama180 opened 1 year ago

BenOussama180 commented 1 year ago
DateRangeFilter::make('Requested at', 'order_date')
                ->config([
                    'ariaDateFormat' => 'F j, Y',
                    'dateFormat' => 'Y-m-d',
                ])->filter(function (Builder $builder, array $date_range) {
                    $builder->whereDate('orders.created_at', '>=', $date_range['minDate'])
                        ->whereDate('orders.created_at', '<=', $date_range['maxDate']);
                }),

image how can i fx this ? @lrljoe

lrljoe commented 1 year ago

Not at my desk right now, but if I remember correctly there's an option() for setting the default dates

lrljoe commented 1 year ago

If not, then I'll do a patch, probably tomorrow, I've been quite busy lately with the main Rappasoft package, but I'll get this sorted for you.

Some of these filters will be making their way into v3 of the core package, along with a host of other improvements.

lrljoe commented 1 year ago

I've done a quick patch, if you fancy testing it out for me then just use the develop branch, the only difference should be that develop doesn't set today as default for date ranges

If you say it works, then I'll add a new release in.

It's passing tests, and it seemed to work when I gave it a quick poke, but testing across both packages is something I'll be looking at later this year with v3.

Let me know if the develop branch works or if I've broken it horribly 😂

BenOussama180 commented 1 year ago

i will test it in a dummy project this afternoon i will let you know!

lrljoe commented 1 year ago

This is fixed in the Rappasoft v3 beta, as DateRangeFilter is a core feature as of v3. I'll be backporting some fixes into v2 once v3 is stable and released. If you're going to Livewire 3, then definitely check out the core Rappasoft V3 beta.