cadence-workflow/cadence

Update cron library to support time zones in cron schedules

Opened this issue · 2 comments

Is your feature request related to a problem? Please describe.
Some workflows need to run at specific local time as they are related to other business processes. Right now the cron schedule can only be specified in the UTC time zone. This is a problem in countries using DST. We had a time zone change recently and our scheduled workflows started 1 hour earlier than expected. It would be great if time zone could be specified in the cron schedule.

Proposed Solution
It should be enough to update robfig/cron from v1.2.0 to v3.x.x. The new version of the library supports CRON_TZ param and then the schedule can be defined as for example: CRON_TZ=America/New_York 5 4 * * *.

It looks like simple, backwards compatible upgrade, Temporal implemented this in temporalio/temporal#2215.
Seems like tzdata also needs to be added, this was done in temporalio/temporal#2277.

On a tangent, I think this issue might be present depending on the implementation of a pattern I've seen, where a workflow is triggered at a certain time by using delayStartSeconds calculated to a specific timestamp. A developer might encounter the same issue with timezones if he or she does not use a monotonic calendar to measure time between dates and locations.

Yes, this looks like an easy task to do. I will try to prioritize this one soon.