Skip to content

Commit

Permalink
Fixes #37069 - Fallback to UTC on invalid timezone
Browse files Browse the repository at this point in the history
  • Loading branch information
ofedoren committed Jan 19, 2024
1 parent 30e83c4 commit f860546
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/controllers/concerns/foreman/controller/timezone.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ def set_timezone
client_timezone = User.current.try(:timezone) || cookies[:timezone]
Time.zone = client_timezone if client_timezone.present?
yield
rescue ArgumentError
Time.zone = ActiveSupport::TimeZone['UTC']
yield
ensure
# Reset timezone for the next thread
Time.zone = default_timezone
Expand Down

0 comments on commit f860546

Please sign in to comment.