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.
I wanted to check and see if you ever got this resolved.
I ran into something similar today and here’s how I’m going to approach it:
On application server (or I guess anywhere) that submits jobs create custom time zones using TimeZoneInfo.CreateCustomTimeZone
Capture the serialized version of the timezones using TimeZoneInfo.ToSerializedString()
Restore timezones in Startup.cs inside of the job submitting application and the Hangfire job server using TimeZoneInfo.FromSerializedString(serializedTz)
I think this would accomplish what you want with being sure timezones are always available where you need them.
In my case, I created a map between our custom timezone and IANA. Then I used TimezoneConverter to convert into system timezone. This library is supposed to produce cross platform system timezone.