Add time zone support for recurring jobs #327
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR solves #160 and #270 by allowing to specify time zone for each recurring jobs. Each of the following jobs will fire at the same time (if Hawaii has no daylight saving time, I haven't google for this):
Here are some facts about current implementation, they will be moved to the docs:
DateTimeProviders.Tzdb
that uses IANA time zone ids, but it is overkill. Custom time zone providers may be implemented for Hangfire to handle this issue later.TimeZoneInfo
in Mono has some critical flaws in the latest stable Mono release at the time of this writing (2.10.8).TimeZoneInfo.Local
has particular issues on the latest tested version of Mono. On Windows,TimeZoneInfo.Local
throwsTimeZoneNotFoundException
. On Unix it returns aTimeZoneInfo
with an Id of "Local", which isn't terribly useful (although it may contain the correct rules). – from http://nodatime.org/1.3.x/userguide/mono.html. This may be solved later, with custom time zone providers.