summaryrefslogtreecommitdiffstats
path: root/app/views
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-05-07 10:42:22 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-05-07 10:42:22 +0000
commited50d42210eaf7ca216e9cd3a043b36aa68eb51d (patch)
treefbc801683ee622f43e790ec6cf2785fd8f94a43c /app/views
parent40c9c3e922e15ab7d88b5d06c60e51ed1ba40a7f (diff)
downloadredmine-ed50d42210eaf7ca216e9cd3a043b36aa68eb51d.tar.gz
redmine-ed50d42210eaf7ca216e9cd3a043b36aa68eb51d.zip
Replace Date.today with User.current.today (#22320).
Depending on the offset between a user's configured timezone and the server timezone, Date.today may be more or less often wrong from the user's perspective, leading to things like issues marked as overdue too early or too late, or yesterday / tomorrow being displayed / selected where 'today' is intended. A test case illustrating the problem with Issue#overdue? is included Patch by Jens Kraemer. git-svn-id: http://svn.redmine.org/redmine/trunk@15379 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/views')
-rw-r--r--app/views/activities/index.html.erb2
-rw-r--r--app/views/common/_calendar.html.erb2
-rw-r--r--app/views/gantts/show.html.erb4
-rw-r--r--app/views/my/blocks/_calendar.html.erb2
-rw-r--r--app/views/my/blocks/_timelog.html.erb2
5 files changed, 6 insertions, 6 deletions
diff --git a/app/views/activities/index.html.erb b/app/views/activities/index.html.erb
index 830f408d3..58664d1cf 100644
--- a/app/views/activities/index.html.erb
+++ b/app/views/activities/index.html.erb
@@ -31,7 +31,7 @@
<%= link_to_content_update(l(:label_next) + " \xc2\xbb",
params.merge(:from => @date_to + @days - 1),
:title => l(:label_date_from_to, :start => format_date(@date_to), :end => format_date(@date_to + @days - 1)),
- :accesskey => accesskey(:next)) unless @date_to >= Date.today %>
+ :accesskey => accesskey(:next)) unless @date_to >= User.current.today %>
</div>
&nbsp;
<% other_formats_links do |f| %>
diff --git a/app/views/common/_calendar.html.erb b/app/views/common/_calendar.html.erb
index d950749aa..eb830b641 100644
--- a/app/views/common/_calendar.html.erb
+++ b/app/views/common/_calendar.html.erb
@@ -7,7 +7,7 @@
<% day = calendar.startdt
while day <= calendar.enddt %>
<%= ("<td class='week-number' title='#{ l(:label_week) }'>#{(day+(11-day.cwday)%7).cweek}</td>".html_safe) if day.cwday == calendar.first_wday %>
-<td class="<%= day.month==calendar.month ? 'even' : 'odd' %><%= ' today' if Date.today == day %>">
+<td class="<%= day.month==calendar.month ? 'even' : 'odd' %><%= ' today' if User.current.today == day %>">
<p class="day-num"><%= day.day %></p>
<% calendar.events_on(day).each do |i| %>
<% if i.is_a? Issue %>
diff --git a/app/views/gantts/show.html.erb b/app/views/gantts/show.html.erb
index 070a0def6..34ee14c5a 100644
--- a/app/views/gantts/show.html.erb
+++ b/app/views/gantts/show.html.erb
@@ -302,9 +302,9 @@
<%= @gantt.lines.html_safe %>
<% ###### Today red line (excluded from cache) ###### %>
-<% if Date.today >= @gantt.date_from and Date.today <= @gantt.date_to %>
+<% if User.current.today >= @gantt.date_from and User.current.today <= @gantt.date_to %>
<%
- today_left = (((Date.today - @gantt.date_from + 1) * zoom).floor() - 1).to_i
+ today_left = (((User.current.today - @gantt.date_from + 1) * zoom).floor() - 1).to_i
style = ""
style += "position: absolute;"
style += "height: #{g_height}px;"
diff --git a/app/views/my/blocks/_calendar.html.erb b/app/views/my/blocks/_calendar.html.erb
index 41ca18a10..89dde0e01 100644
--- a/app/views/my/blocks/_calendar.html.erb
+++ b/app/views/my/blocks/_calendar.html.erb
@@ -1,6 +1,6 @@
<h3><%= l(:label_calendar) %></h3>
-<% calendar = Redmine::Helpers::Calendar.new(Date.today, current_language, :week)
+<% calendar = Redmine::Helpers::Calendar.new(User.current.today, current_language, :week)
calendar.events = calendar_items(calendar.startdt, calendar.enddt) %>
<%= render :partial => 'common/calendar', :locals => {:calendar => calendar } %>
diff --git a/app/views/my/blocks/_timelog.html.erb b/app/views/my/blocks/_timelog.html.erb
index 7fcac4aa4..14a0711e9 100644
--- a/app/views/my/blocks/_timelog.html.erb
+++ b/app/views/my/blocks/_timelog.html.erb
@@ -29,7 +29,7 @@ entries_by_day = entries.group_by(&:spent_on)
<tbody>
<% entries_by_day.keys.sort.reverse.each do |day| %>
<tr class="odd">
- <td><strong><%= day == Date.today ? l(:label_today).titleize : format_date(day) %></strong></td>
+ <td><strong><%= day == User.current.today ? l(:label_today).titleize : format_date(day) %></strong></td>
<td colspan="2"></td>
<td class="hours"><em><%= html_hours("%.2f" % entries_by_day[day].sum(&:hours).to_f) %></em></td>
<td></td>