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

TryGetTimeZoneInfo failed in version 4.0.0 #108

Closed
Patryx opened this issue Jan 12, 2022 · 7 comments
Closed

TryGetTimeZoneInfo failed in version 4.0.0 #108

Patryx opened this issue Jan 12, 2022 · 7 comments
Labels

Comments

@Patryx
Copy link

Patryx commented Jan 12, 2022

Hi,
Unfortunately in a new version 4.0.0 method TryGetTimeZoneInfo works not well.

Take a look:
var timezones = TimeZoneConverter.TZConvert.KnownWindowsTimeZoneIds.ToList(); var isFound = TZConvert.TryGetTimeZoneInfo(timeZone, out var timeZone)

isFound in version 3.5.0 was TRUE, but in version 4.0.0 is here always FALSE.

@mattjohnsonpint
Copy link
Owner

Hi. I'm not sure exactly what you mean, as that code isn't quite complete.

If there's a particular time zone that is not found, please let me know which one.

Also, please let me know which OS and version you are using, and be sure you have the latest updates.

@63Digital
Copy link

I've got a similar issue. I've cloned the repo and you've a couple of failing tests. I think the culprit is line 328 in TZConvert.cs

I'm on windows so initially systemTimeZones is set to TimeZoneInfo.GetSystemTimeZones()

line 330 then sets it to the output of GetSystemTimeZonesLinux()

I fixed it locally by doing this:

if (IsWindows)
{
     systemTimeZones = TimeZoneInfo.GetSystemTimeZones();
}
else
{
    systemTimeZones = GetSystemTimeZonesLinux();
}

@mattjohnsonpint
Copy link
Owner

Ahh. I messed that up indeed. I'll fix later today. Thanks!

@saridakis
Copy link

I have the same issue ... you can try the 'Europe/Athens' timezone that is not found ...

@Patryx
Copy link
Author

Patryx commented Jan 12, 2022

@mattjohnsonpint Except this failure, could you tell me if there are any differences in names of timezones between version 3.5.0 and 4.0.0?
To clarify: I have timezone names (timeZoneName) generated by your library v3.5.0 (TZConvert.TryGetTimeZoneInfo(timeZoneName, out var timeZone)) and now I want to use v4.0.0 using the names from v3.5.0. Will it work in all cases?

@mattjohnsonpint
Copy link
Owner

It should still work, yes. The main difference in recent versions is the data has been updated, and I've dropped support for some older versions of .NET.

I'm AFK much of today, but 'll have an update published later this evening (Pacific time). If this is causing an immediate problem, please use the previous versions until I can publish a fix.

Thanks.

@mattjohnsonpint
Copy link
Owner

mattjohnsonpint commented Jan 13, 2022

Fixed in version 5.0.0. Would have just been 4.0.1, but I found and fixed another issue, making a breaking change for the Known* collections to be exposed as IReadOnlyCollection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants