summaryrefslogtreecommitdiffstats
path: root/app/models/query.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-05-26 12:07:56 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-05-26 12:07:56 +0000
commit189be55235b75c32908a4037825b453513673e64 (patch)
treea1bfcc244fa32c7e326487d145ec1b6232d51a5b /app/models/query.rb
parent84084b01689718ea901dcd66d66ab676c7bc4790 (diff)
downloadredmine-189be55235b75c32908a4037825b453513673e64.tar.gz
redmine-189be55235b75c32908a4037825b453513673e64.zip
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
Diffstat (limited to 'app/models/query.rb')
-rw-r--r--app/models/query.rb14
1 files changed, 10 insertions, 4 deletions
diff --git a/app/models/query.rb b/app/models/query.rb
index 9e2254f60..b66b091f7 100644
--- a/app/models/query.rb
+++ b/app/models/query.rb
@@ -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