Skip to content

Is it possible to set the timezone used on the dashboard? #1028

Answered by bensheldon
alexandergitter asked this question in Q&A
Discussion options

You must be logged in to vote

Interesting! There isn't currently a supported way to do that (maybe there should be), but here's a workaround:

# config/initializers/good_job.rb
Rails.application.config.to_prepare do
  class GoodJob::ApplicationController < ActionController::Base
    CUSTOM_TIMEZONE = "America/Los_Angeles"

    around_action :set_custom_timezone

    def set_custom_timezone
      original_timezone = Time.zone
      Time.zone = CUSTOM_TIMEZONE
      yield
    ensure
      Time.zone = original_timezone
    end
  end
end

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@alexandergitter
Comment options

Answer selected by alexandergitter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants