summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2019-06-20 06:23:48 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2019-06-20 06:23:48 +0000
commit001853ef7951b866089015a7d22e07c787e541a8 (patch)
treef42101bec9faa24cafe1e393b389827f593cd22b /app
parent87e82b4894671b222656c93f5255471747267340 (diff)
downloadredmine-001853ef7951b866089015a7d22e07c787e541a8.tar.gz
redmine-001853ef7951b866089015a7d22e07c787e541a8.zip
Groups are incorrect when grouping by date without user timezone set.
git-svn-id: http://svn.redmine.org/redmine/trunk@18264 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/models/user.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index 933ac7869..096adc4a9 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -544,10 +544,14 @@ class User < Principal
# Returns the day of +time+ according to user's time zone
def time_to_date(time)
- if time_zone.nil?
- time.to_date
+ self.convert_time_to_user_timezone(time).to_date
+ end
+
+ def convert_time_to_user_timezone(time)
+ if self.time_zone
+ time.in_time_zone(self.time_zone)
else
- time.in_time_zone(time_zone).to_date
+ time.utc? ? time.localtime : time
end
end