summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-09-11 17:45:21 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-09-11 17:45:21 +0000
commit8d6b32645c7b3e928f01d3faf29e5e9fb1c89129 (patch)
tree3590e6c1f1df1c25bbd5d134201c6e03cec36f43 /app
parenta592d6c40dd8406296ae332dbe3b2dd152648449 (diff)
downloadredmine-8d6b32645c7b3e928f01d3faf29e5e9fb1c89129.tar.gz
redmine-8d6b32645c7b3e928f01d3faf29e5e9fb1c89129.zip
Template error when user's timezone isn't set and UTC timestamps are used (#1889).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1801 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/helpers/application_helper.rb2
-rw-r--r--app/models/user.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 78e5bdc65..cc26127d6 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -95,7 +95,7 @@ module ApplicationHelper
return nil unless time
time = time.to_time if time.is_a?(String)
zone = User.current.time_zone
- local = zone ? time.in_time_zone(zone) : (time.utc? ? time.utc_to_local : time)
+ local = zone ? time.in_time_zone(zone) : (time.utc? ? time.localtime : time)
@date_format ||= (Setting.date_format.blank? || Setting.date_format.size < 2 ? l(:general_fmt_date) : Setting.date_format)
@time_format ||= (Setting.time_format.blank? ? l(:general_fmt_time) : Setting.time_format)
include_date ? local.strftime("#{@date_format} #{@time_format}") : local.strftime(@time_format)
diff --git a/app/models/user.rb b/app/models/user.rb
index 4f82f61b2..132896ad9 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -144,7 +144,7 @@ class User < ActiveRecord::Base
end
def time_zone
- self.pref.time_zone.nil? ? nil : TimeZone[self.pref.time_zone]
+ @time_zone ||= (self.pref.time_zone.blank? ? nil : TimeZone[self.pref.time_zone])
end
def wants_comments_in_reverse_order?