Skip to content

Instantly share code, notes, and snippets.

@kbaum
Last active December 14, 2015 20:58
Show Gist options
  • Save kbaum/5147653 to your computer and use it in GitHub Desktop.
Save kbaum/5147653 to your computer and use it in GitHub Desktop.
Set the timezone within an around filter
around_filter :set_time_zone
private
def set_time_zone
old_time_zone = Time.zone
Time.zone = browser_timezone if browser_timezone.present?
yield
ensure
Time.zone = old_time_zone
end
def browser_timezone
cookies["browser.timezone"]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment