@@ -769,10 +769,13 class Query < ActiveRecord::Base | |||||
769 | def date_clause(table, field, from, to) |
|
769 | def date_clause(table, field, from, to) | |
770 | s = [] |
|
770 | s = [] | |
771 | if from |
|
771 | if from | |
772 | s << ("#{table}.#{field} > '%s'" % [connection.quoted_date((from - 1).to_time.end_of_day)]) |
|
772 | from_yesterday = from - 1 | |
|
773 | from_yesterday_utc = Time.gm(from_yesterday.year, from_yesterday.month, from_yesterday.day) | |||
|
774 | s << ("#{table}.#{field} > '%s'" % [connection.quoted_date(from_yesterday_utc.end_of_day)]) | |||
773 | end |
|
775 | end | |
774 | if to |
|
776 | if to | |
775 | s << ("#{table}.#{field} <= '%s'" % [connection.quoted_date(to.to_time.end_of_day)]) |
|
777 | to_utc = Time.gm(to.year, to.month, to.day) | |
|
778 | s << ("#{table}.#{field} <= '%s'" % [connection.quoted_date(to_utc.end_of_day)]) | |||
776 | end |
|
779 | end | |
777 | s.join(' AND ') |
|
780 | s.join(' AND ') | |
778 | end |
|
781 | end |
General Comments 0
You need to be logged in to leave comments.
Login now