Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Range of Dates Query converting to UTC before query #1436

Open
devsheva opened this issue Aug 31, 2023 · 0 comments
Open

Range of Dates Query converting to UTC before query #1436

devsheva opened this issue Aug 31, 2023 · 0 comments

Comments

@devsheva
Copy link

I've wrote this custom predicate

Ransack.configure do |config|
  config.add_predicate "end_of_day_lteq",
                       arel_predicate: "lteq",
                       formatter: proc { |v| v.end_of_day }
end

But for some reason v , that represent the date in this case, is casted to UTC.

This is the example.

{8/11 |======================================================= 72 ========================================================>                                             |  ETA: 00:00:01
    :created_at => {
        :from => Tue, 29 Aug 2023,
          :to => Thu, 31 Aug 2023
    }
}
{
    :ranges => [
        [0] {
            :field => "created_at",
             :from => "2023-08-29",
               :to => "2023-08-31"
        }
    ]
}
{
    :g => {
        "0" => {
                                     :m => "and",
                             :status_in => [],
                       :created_at_gteq => Tue, 29 Aug 2023,
            :created_at_end_of_day_lteq => Thu, 31 Aug 2023
        }
    }
}
"SELECT DISTINCT \"orders\".* FROM \"orders\" WHERE (\"orders\".\"created_at\" >= '2023-08-28 22:00:00' AND \"orders\".\"created_at\" <= '2023-08-30 23:59:59.999999')"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant