diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index ff01fcae..61ad8209 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -2,10 +2,6 @@
# application.
module ApplicationHelper
- def user_time
- Time.zone.now
- end
-
# Replicates the link_to method but also checks request.request_uri to find
# current page. If that matches the url, the link is marked id = "current"
#
@@ -24,7 +20,7 @@ module ApplicationHelper
end
def days_from_today(date)
- date.in_time_zone.to_date - user_time.to_date
+ date.in_time_zone.to_date - current_user.time.to_date
end
# Check due date in comparison to today's date Flag up date appropriately with
diff --git a/app/helpers/todos_helper.rb b/app/helpers/todos_helper.rb
index 61e79a8c..8e1aa83e 100644
--- a/app/helpers/todos_helper.rb
+++ b/app/helpers/todos_helper.rb
@@ -161,11 +161,11 @@ module TodosHelper
def staleness_class(item)
if item.due || item.completed?
return ""
- elsif item.created_at < user_time - (prefs.staleness_starts * 3).days
+ elsif item.created_at < current_user.time - (prefs.staleness_starts * 3).days
return " stale_l3"
- elsif item.created_at < user_time - (prefs.staleness_starts * 2).days
+ elsif item.created_at < current_user.time - (prefs.staleness_starts * 2).days
return " stale_l2"
- elsif item.created_at < user_time - (prefs.staleness_starts).days
+ elsif item.created_at < current_user.time - (prefs.staleness_starts).days
return " stale_l1"
else
return ""
diff --git a/app/views/layouts/mobile.m.erb b/app/views/layouts/mobile.m.erb
index 3ee740a5..d23a83e3 100644
--- a/app/views/layouts/mobile.m.erb
+++ b/app/views/layouts/mobile.m.erb
@@ -14,7 +14,7 @@
<% if !(@new_mobile || @edit_mobile)
if !@prefs.nil? -%>
<%= @down_count %> <%=
- user_time.strftime(@prefs.title_date_format) -%>
+ current_user.time.strftime(@prefs.title_date_format) -%>
<%= (link_to("0-New action", formatted_new_todo_path(:m, new_todo_params))+" | ") unless @new_mobile -%>
<%= (link_to("1-Home", formatted_todos_path(:m))+" | ") unless @home -%>
diff --git a/app/views/layouts/standard.html.erb b/app/views/layouts/standard.html.erb
index 2326a047..ebe415d9 100644
--- a/app/views/layouts/standard.html.erb
+++ b/app/views/layouts/standard.html.erb
@@ -31,7 +31,7 @@
<% if @count -%>
<%= @count %>
<% end -%>
- <%= user_time.strftime(@prefs.title_date_format) %>
+ <%= current_user.time.strftime(@prefs.title_date_format) %>
diff --git a/app/views/preferences/index.html.erb b/app/views/preferences/index.html.erb
index 05c90a86..aab4d384 100644
--- a/app/views/preferences/index.html.erb
+++ b/app/views/preferences/index.html.erb
@@ -5,9 +5,9 @@
- First name: <%= current_user.first_name %>
- Last name: <%= current_user.last_name %>
- - Date format: <%= prefs.date_format %> Your current date: <%= format_date(user_time) %>
- - Title date format: <%= prefs.title_date_format %> Your current title date: <%= user_time.strftime(prefs.title_date_format) %>
- - Time zone: <%= prefs.time_zone %> Your current time: <%= user_time.strftime('%I:%M %p') %>
+ - Date format: <%= prefs.date_format %> Your current date: <%= format_date(current_user.time) %>
+ - Title date format: <%= prefs.title_date_format %> Your current title date: <%= current_user.time.strftime(prefs.title_date_format) %>
+ - Time zone: <%= prefs.time_zone %> Your current time: <%= current_user.time.strftime('%I:%M %p') %>
- Week starts on: <%= Preference.day_number_to_name_map[prefs.week_starts] %>
- Show the last <%= prefs.show_number_completed %> completed items
- Show completed projects in sidebar: <%= prefs.show_completed_projects_in_sidebar %>
diff --git a/app/views/todos/_edit_mobile.rhtml b/app/views/todos/_edit_mobile.rhtml
index 75abb40f..0c39945d 100644
--- a/app/views/todos/_edit_mobile.rhtml
+++ b/app/views/todos/_edit_mobile.rhtml
@@ -3,7 +3,7 @@
<%= error_messages_for("todo") %>
-<% this_year = user_time.to_date.strftime("%Y").to_i
+<% this_year = current_user.time.to_date.strftime("%Y").to_i
if parent_container_type == 'show_mobile' -%>
<%= check_box_tag("done", 1, @todo && @todo.completed?, "tabindex" => 1) %>
<% end -%>