@@ -769,10 +769,13 class Query < ActiveRecord::Base | |||
|
769 | 769 | def date_clause(table, field, from, to) |
|
770 | 770 | s = [] |
|
771 | 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 | 775 | end |
|
774 | 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 | 779 | end |
|
777 | 780 | s.join(' AND ') |
|
778 | 781 | end |
General Comments 0
You need to be logged in to leave comments.
Login now