Closed helenatxu closed 5 years ago
You pasted a source code for a column, not a filter, so I suppose it is a typo.
Datagrid "knows" about beginning_of_day
and end_of_day
caveat: https://github.com/bogdan/datagrid/blob/master/lib/datagrid/filters/date_filter.rb#L9
However, if you pass a block into range filter, you would need to convert date to timestamp manually.
Sorry, it was a typo yes, I've already corrected it.
The filter has nothing special in it, it works fine but it just doesn't show any result when you select the same date for the first and the last day in the datepicker.
filter(:date_sent, :date, range: true, header: 'Date')
Track the SQL query that is generated in the console and compare it to what you would expect.
Closing by inactivity. Feel free to follow up.
Hello again :)
I have another grid, with regular columns and filters, I have also one column like this:
I've discovered that when the user selects same date for first date and last date in the range datepicker filter, it doesn't work properly, it shows 0 when it should show the number of entries that match that date.
I think it's related with how Rails Activerecord works when selecting dates, it doesn't check the whole time range in a day, but only the "beginning" of the day. This is what I mean.
I use the
.all_day
fix to get that full time range in a day, but I'm not sure how to use that in this situation, or maybe it's a bug in the datepicker filter as it should check that date when the date range lasts only one day.