Fixed time zone issues introduced by r9719 (#10996).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9726 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang committed 2012-05-26 12:07:56 +00:00
1 parent 84084b0168
commit 189be55235
6 files changed
+78 -32

No files matched your search

+10 -4
View File
@@ -848,12 +848,18 @@ class Query < ActiveRecord::Base
s = []
if from
from_yesterday = from - 1
from_yesterday_utc = Time.gm(from_yesterday.year, from_yesterday.month, from_yesterday.day)
s << ("#{table}.#{field} > '%s'" % [connection.quoted_date(from_yesterday_utc.end_of_day)])
from_yesterday_time = Time.local(from_yesterday.year, from_yesterday.month, from_yesterday.day)
if self.class.default_timezone == :utc
from_yesterday_time = from_yesterday_time.utc
end
s << ("#{table}.#{field} > '%s'" % [connection.quoted_date(from_yesterday_time.end_of_day)])
end
if to
to_utc = Time.gm(to.year, to.month, to.day)
s << ("#{table}.#{field} <= '%s'" % [connection.quoted_date(to_utc.end_of_day)])
to_time = Time.local(to.year, to.month, to.day)
if self.class.default_timezone == :utc
to_time = to_time.utc
end
s << ("#{table}.#{field} <= '%s'" % [connection.quoted_date(to_time.end_of_day)])
end
s.join(' AND ')
end