It seems like I'm always trying to figure this out ...
I have a Heroku scheduler that runs every 10 meters looking for new scheduled tasks that will be executed, but it doesn’t work when I expect this to be the time zone difference, but I don’t know exactly how I should do the comparison, so that it works as I expect.
in the rake problem:
schedules = Schedule.where('status in (?) and next_run < ?', ['new', nil, ''], DateTime.current)
in application.rb
config.time_zone = 'Auckland'
config.active_record.default_timezone = :local
Now, the exact example that I just saw that did not do what was expected was as follows:
- A user in New Zealand set up a schedule from the next day on Wednesday, February 18, at 10:00
- Based on the above task, it was actually launched right after 9pm on Tuesday February 17th.
The difference is +13 hours for the NZ time zone.
, , , ?
1:
, , :