Fork me on GitHub

Use instead of

22 Oct 2014

Dan Kohn


Using default Ruby Time, Date and DateTime classes will not show times in the time zone specified by config.time_zone in application.rb. = "Alaska"

These show the local time, not the time in Alaska (unless you're already in Alaska).


You should instead use ActiveSupport methods of to pickup the Rails time zone.

This is well-described in The Exhaustive Guide to Rails Time Zones. This should be easy to write a rails_best_practice rule to implement.

Time zone bugs are particularly tricky when the production server is set to a different time zone (often UTC) than the development machine. Using '` avoids this breakdown of dev/prod parity.