This gem automatically detects the user's timezone offset from their browser by setting a cookie, then applies it in the controller by setting Time.zone
to the appropriate timezone.
Add the gem to your Gemfile:
gem 'browser-timezone', :git => "git://github.com/magoosh/browser-timezone.git"
In your controller:
class ApplicationController < ActionController::Base
set_timezone_from_browser
end
That's it.
Thanks to @technoweenie's article for the inspiration.