mtdowling / cron-expression

CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due
http://mtdowling.com/blog/2012/06/03/cron-expressions-in-php/
MIT License
4.9k stars 335 forks source link

Wrong Timezone issue #42

Closed TheDigitalOrchard closed 10 years ago

TheDigitalOrchard commented 10 years ago

I'm having an issue where the scheduled timestamp is for UTC rather than my system's timezone. I see in the HoursField::increment() method that the timezone is temporarily set to UTC before the incrementing is done. This seems to be resulting in a configuration for UTC instead of the system timezone:

* 7-7 * * *

This schedules for 7am-7pm UTC.

I'll try to play around with the library's code to see if I'm overlooking something obvious, and if I find a fix, I'll submit a pull request.

TheDigitalOrchard commented 10 years ago

Hmmm, not seeing the problem anymore. Closing.

TheDigitalOrchard commented 10 years ago

My confusion was due to writing the hour range as 7-7 (12 hour time) instead of 7-19 (24 hour time). :)