Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross platform TimeZoneInfo.Local #1167

Closed
jostrander opened this issue Apr 12, 2018 · 3 comments

Comments

@jostrander
Copy link

commented Apr 12, 2018

Ran across an issue I was trying to figure out for a few days. I'm running 2 containers locally in docker on .net core runtime for linux, and developing with windows, all using the same backend sql storage. If you start the containers, they will use the IANA time zone America/New_York, and store that in the database. However when windows goes to process the job it will fail with a TimeZoneNotFoundException, as it doesn't recognize the time zone. The same happens the other way around. If you start the windows one first, it sets to Eastern Standard Time, then the linux containers won't be able to process the job.

Should the job processor be able to convert from IANA to Windows time zones and vis-versa instead of throwing an exception? I know this is technically an upstream issue in .net core at the moment as well, but curious if you had any plans to support this, maybe with Cronos in the future?

Also, on a related note. The dashboard will break when it can't find the time zone as well with the same exception. So theoretically you can't have your dashboard on a windows server, and your workers on linux using IANA time zones.

Hangfire@1.6.17
Hangfire.SqlServer@1.6.17

@Karen-Abgaryan

This comment has been minimized.

Copy link

commented Jul 21, 2018

Hi!
I also encountered this problem, especially in dashboard. It would be great if calls to the System.TimeZoneInfo.FindSystemTimeZoneById would be replaced with TZConvert.GetTimeZoneInfo.

Either of these will return same time zone:
TimeZoneInfo tzi = TZConvert.GetTimeZoneInfo("Eastern Standard Time");
TimeZoneInfo tzi = TZConvert.GetTimeZoneInfo("America/New_York");

About TimeZoneConverter

@mihey8800

This comment has been minimized.

Copy link

commented Sep 17, 2018

Hi. Same issue. Will be solved? I think it is a simple fix...

@odinserj

This comment has been minimized.

Copy link
Member

commented Apr 2, 2019

Starting from Hangfire 1.7.0 you can use custom ITimeZoneResolver implementation and set it via BackgroundJobServerOptions. For example, you can use the TimeZoneConverter package to have a cross-platform resolver, please see this comment for details.

@odinserj odinserj closed this Apr 2, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
4 participants
You can’t perform that action at this time.