Skip to content

Wrong value for lteq_datetime predicate #61

@aleksey-alt

Description

@aleksey-alt

DateTimeRangeInput inherits from ActiveAdmin's DateRangeInput. So it uses lteq_datetime predicate. But definition of this predicate is correct if we use date part of the datetime/timestamp value rather than whole value
https://github.com/activeadmin/activeadmin/blob/v2.3.1/lib/ransack_ext.rb#L17

So now if end range field of the date_time_range filter is non-empty we always get incorrect request to DB.

For the whole value when lteq predicate is being converted to lt predicate then microseconds have to be increased by 1 (at least for Postgresql that stores timestamps with microsecond resolution) instead of days.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions