mirror of
https://github.com/rickbarrette/stopwatch.git
synced 2026-11-17 19:50:36 -05:00
Closing time in local time for users without a time zone
Users without a time zone in their preferences fell back to UTC, so a 17:00 closing time stopped their timers hours early (e.g. at noon on a US Eastern server). Like Redmine (User#today), they now get the server's local time: for closing time, the Running timers page's "stopped at" field, and the "Timer stopped by" note. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
82ffe7ed49
commit
9c937c6d6b
7 files changed
+41
-15
No files matched your search
@@ -40,9 +40,11 @@ class StopwatchRunningTimersController < StopwatchController
|
||||
User.current.allowed_to?(:view_running_timers, nil, global: true) or deny_access
|
||||
end
|
||||
|
||||
# The "stopped at" field is a local date and time in the viewer's time zone
|
||||
# The "stopped at" field is a local date and time in the viewer's time zone, or the server's local time for
|
||||
# a viewer without one (as Redmine shows times)
|
||||
def parse_user_time(value)
|
||||
(User.current.time_zone || Time.zone).parse(value.to_s)
|
||||
zone = User.current.time_zone
|
||||
zone ? zone.parse(value.to_s) : Time.parse(value.to_s)
|
||||
rescue ArgumentError
|
||||
nil
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user