livewire-powergrid
                                
                                
                                
                                    livewire-powergrid copied to clipboard
                            
                            
                            
                        Date Picker Filter - Wrong Date ?!
I have a strange behaviour of filtering dates using flatpickr, (see video). I have records on 12/05/2022... when I choose the exact date on the picker: it returns zero rows.... but if I choose the next day 13/05/2022 all the records of 12/05/2022 are retrieved.
https://user-images.githubusercontent.com/17271768/168447958-377897ee-7809-4571-bb06-3aa0de8c6af9.mp4
So, my flatpickr in the config file is like this :

My component , in the addColumn() method

My component, in the columns() method

So I think this is something regarding my Carbon transformation.... the data in the database is stored Y-m-d H:I:s, I use the callback to transform to locale date format d/m/Y
This would be the best way:
public function addColumns(): PowerGridEloquent
{
     return PowerGrid::eloquent()
         ->addColumn('data_inicio')
         ->addColumn('data_inicio_formatted', function ($entry) {
               return Carbon::parse($entry->data_inicio)->format('d/m/Y');
         });
}
public function columns(): array
   Column::add()
         ->title('Data Inicio')
         ->field('data_inicio_formatted')
         ->makeInputDatePicker('data_inicio'),
                                    
                                    
                                    
                                
Don't Work... I have the same behaviour.... The dates of 12/05/2022, only appear when I choose in the date picker 13/05/2022. I wonder if this behaviour is for having the date filter format like 'd/m/Y' but the field rendered is 'd/m/Y H:m:s', using your example... we reference the 'data_inicio' RAW from the database, using default 'Y-m-d H:i:s'
maybe there is a flag for single date selection?
Strange, here the filtering is returning correctly

Something wrong with my date... I choose a date between 15 and 16 of May...
inspecting livewire filter date array ... is getting 14 to 15 (midnight) ....

Interesting. I'll see if I can find something around here. but feel free to correct and submit a PR!
I think the same happened here : https://github.com/Power-Components/livewire-powergrid/issues/230
I believe these changes can resolve some of these issues.
https://github.com/Power-Components/livewire-powergrid/pull/778