Skip to content

Latest commit

 

History

History
25 lines (16 loc) · 743 Bytes

README.md

File metadata and controls

25 lines (16 loc) · 743 Bytes

Browser Timezone (for Rails)

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.

Installation

Add the gem to your Gemfile:

gem 'browser-timezone', :git => "git://github.com/magoosh/browser-timezone.git"

Usage

In your controller:

class ApplicationController < ActionController::Base
  set_timezone_from_browser
end

That's it.

Thanks to @technoweenie's article for the inspiration.