activeadmin: Date range filter doesn't cover the last day
refs #2374 and activerecord-hackery/ransack#458

With this UI we create a request like ?q[date_lteq]=2014-10-29, put this queries the db with appointments.date <= ‘2014-10-29 00:00:00’, but it should be appointments.date <= '2014-10-29 23:59:59', otherwise it not cover the last date of the range.
We could solve this via a hidden field for date_lteq witch adds the 23:59:59 via JS, like we do it with the predict select.
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Comments: 25 (20 by maintainers)
#4341
@chrp - I like your approach - my previous workaround for this stopped working when I started using master. However, your formatter caused problems for me considering timezones. I ended up using this predicate instead, and it seems to do what I want:
@timoschilling - here’s our temporary solution for your problem:
Change date_range filter to use a custom ransack predicate:
And define that predicate in an intializer or next to that monkey patch:
So
lteqdateprovides a more intuitivelteqfor dates.