Recurring job with custom timezone

recurring
Tags: #<Tag:0x00007f281d60a990>

#1

Hello,

I am trying to use custom timezone info to schedule a recurring job, and it seems like it is not supported

I set up the timezone as follow:

TimeZoneInfo.CreateCustomTimeZone(
“CST”,
TimeSpan.FromHours(-6),
“Central Standard Time(-06:00)”,
“CST(-06:00)”
)

What I am doing wrong as the job is not scheduled?

Thank you,


#2

Just curious why you would need to create a custom time zone?

If you are using CreateCustomTimeZone the new timezone is stored in the registry of the Windows Server or PC where you created the timezone.

If it ends up running the code on another node that could be a problem. There is a way to save and restore custom timezones using serialization:
https://docs.microsoft.com/en-us/dotnet/standard/datetime/saving-and-restoring-time-zones

But I would expect Hangfire would need to use that in its recurring job code in order for custom timezones to work correctly.


#3

It looks like only the timezone id is being stored by HangFire. I couldn’t find any serialization done for the timezone info.

As far as why, in most of our in house applications we provide 3 variants of most US timezones. For example, CPT is the central timezone that auto adjusts, CDT has no adjustment rule and is fixed at UTC-0500 , and CST is fixed at UTC-0600. I already mapped the system Central Standard Time to CPT, but I need to add custom ones for CST and CDT.

Thank you,