I've been having horrible timezone issues with Heroku. There is a lot of information out there, but most of it doesn't work anymore or changes the database connection to store the dates differently.
As you know Heroku has it's servers in PST timezone. As a developer in EST I want to run
Time.now instead of
Time.current. Instead of switching my application over to use
Time.current. All I needed to do is set the
TZ environmental variable to
At first I followed http://stackoverflow.com/questions/16169334/cannot-set-heroku-timezone this. I saved the file and pushed to Heroku, but it didn't appear to work. The issue I had was leaving
config.active_record.default_timezone = :local line in. This ended up producing some weird results and changed how the database stored dates. After a lot of head banging this is my final solution. First remove
config.active_record.default_timezone line from your configuration.
Make sure you have set:
config.time_zone = 'Eastern Time (US & Canada)'
Then push this configuration change to Heroku:
heroku config:add TZ=America/New_York
If you set
TZ=EST like other tutorials say, then you will have issues with daylight savings time.