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

TimeZoneInfo.HasIanaId returning false for an IANA timezone on Linux #58326

Closed
roji opened this issue Aug 29, 2021 · 4 comments
Closed

TimeZoneInfo.HasIanaId returning false for an IANA timezone on Linux #58326

roji opened this issue Aug 29, 2021 · 4 comments
Assignees
Milestone

Comments

@roji
Copy link
Member

roji commented Aug 29, 2021

Running on Ubuntu 21.04, dotnet SDK 6.0.100-rc.1.21379.2, TimeZoneInfo.HasIanaId is unexpectedly returning false.

System timezone information:

> timedatectl
               Local time: Sun 2021-08-29 11:03:06 CEST
           Universal time: Sun 2021-08-29 09:03:06 UTC
                 RTC time: Sun 2021-08-29 09:03:06
                Time zone: Europe/Berlin (CEST, +0200)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

Based on the sample GetIanaTimeZoneId method in this blog article:

Console.WriteLine(TimeZoneInfo.Local); // (UTC+01:00) Central European Time (Berlin)
Console.WriteLine(TimeZoneInfo.Local.Id); // Europe/Berlin
Console.WriteLine(TimeZoneInfo.Local.HasIanaId); // false

if (!TimeZoneInfo.TryConvertWindowsIdToIanaId(TimeZoneInfo.Local.Id, out _))
    Console.WriteLine($"Could not convert '{TimeZoneInfo.Local.Id}'"); // Could not convert 'Europe/Berlin'
@dotnet-issue-labeler dotnet-issue-labeler bot added area-System.Globalization untriaged New issue has not been triaged by the area owner labels Aug 29, 2021
@ghost
Copy link

ghost commented Aug 29, 2021

Tagging subscribers to this area: @tarekgh, @safern
See info in area-owners.md if you want to be subscribed.

Issue Details

Running on Ubuntu 21.04, dotnet SDK 6.0.100-rc.1.21379.2, TimeZoneInfo.HasIanaId is unexpectedly returning false.

System timezone information:

> timedatectl
               Local time: Sun 2021-08-29 11:03:06 CEST
           Universal time: Sun 2021-08-29 09:03:06 UTC
                 RTC time: Sun 2021-08-29 09:03:06
                Time zone: Europe/Berlin (CEST, +0200)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

Based on the sample GetIanaTimeZoneId method in this blog article:

Console.WriteLine(TimeZoneInfo.Local); // (UTC+01:00) Central European Time (Berlin)
Console.WriteLine(TimeZoneInfo.Local.Id); // Europe/Berlin
Console.WriteLine(TimeZoneInfo.Local.HasIanaId); // false

if (!TimeZoneInfo.TryConvertWindowsIdToIanaId(TimeZoneInfo.Local.Id, out _))
    Console.WriteLine($"Could not convert '{TimeZoneInfo.Local.Id}'"); // Could not convert 'Europe/Berlin'
Author: roji
Assignees: -
Labels:

area-System.Globalization, untriaged

Milestone: -

@tarekgh tarekgh added area-System.Runtime and removed untriaged New issue has not been triaged by the area owner area-System.Globalization labels Aug 29, 2021
@ghost
Copy link

ghost commented Aug 29, 2021

Tagging subscribers to this area: @dotnet/area-system-runtime
See info in area-owners.md if you want to be subscribed.

Issue Details

Running on Ubuntu 21.04, dotnet SDK 6.0.100-rc.1.21379.2, TimeZoneInfo.HasIanaId is unexpectedly returning false.

System timezone information:

> timedatectl
               Local time: Sun 2021-08-29 11:03:06 CEST
           Universal time: Sun 2021-08-29 09:03:06 UTC
                 RTC time: Sun 2021-08-29 09:03:06
                Time zone: Europe/Berlin (CEST, +0200)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

Based on the sample GetIanaTimeZoneId method in this blog article:

Console.WriteLine(TimeZoneInfo.Local); // (UTC+01:00) Central European Time (Berlin)
Console.WriteLine(TimeZoneInfo.Local.Id); // Europe/Berlin
Console.WriteLine(TimeZoneInfo.Local.HasIanaId); // false

if (!TimeZoneInfo.TryConvertWindowsIdToIanaId(TimeZoneInfo.Local.Id, out _))
    Console.WriteLine($"Could not convert '{TimeZoneInfo.Local.Id}'"); // Could not convert 'Europe/Berlin'
Author: roji
Assignees: -
Labels:

area-System.Runtime

Milestone: -

@tarekgh tarekgh self-assigned this Aug 29, 2021
@tarekgh tarekgh added this to the 6.0.0 milestone Aug 29, 2021
@ghost ghost added in-pr There is an active PR which will close this issue when it is merged and removed in-pr There is an active PR which will close this issue when it is merged labels Aug 31, 2021
@tarekgh
Copy link
Member

tarekgh commented Aug 31, 2021

Fixed through #58414

@roji thanks for reporting this issue. I hope when you'll have a chance to try the fix. Let me know if there is anything I can help with.

@tarekgh tarekgh closed this as completed Aug 31, 2021
@roji
Copy link
Member Author

roji commented Aug 31, 2021

Thanks for the quick turnaround @tarekgh, happy this got fixed for 6.0! Will let you know if I run into anything else.

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

No branches or pull requests

3 participants