I seem to always struggle understanding this...
I have the Heroku scheduler running every 10m looking for new scheduled jobs to be run but it is not running when I expect it to - the difference is the time zone but I'm unclear exactly how I should do the comparison so it works the way I expect.
in the rake task we have:
schedules = Schedule.where('status in (?) and next_run < ?', ['new', nil, ''], DateTime.current)
in application.rb is
config.time_zone = 'Auckland'
config.active_record.default_timezone = :local
Now, the exact example I have just seen that didn't do what was expected was this:
Difference is the +13 hours for the NZ time zone.
Question is, how should I do this comparison to get the schedule to fire when I am expecting?
UPDATE 1: So after a bit of messing about, a few specific items worked for me:
Use heroku env variable to set the default time zone:
heroku config:add TZ="America/Los_Angeles" # example for Los Angeles
I suppose, for your case it would be:
heroku config:add TZ="Pacific/Auckland"