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

Wrong TimeZone Information in NET Core 3.1 and NET 5 #43518

Closed
macriluis opened this issue Oct 16, 2020 · 11 comments · Fixed by #43786
Closed

Wrong TimeZone Information in NET Core 3.1 and NET 5 #43518

macriluis opened this issue Oct 16, 2020 · 11 comments · Fixed by #43786
Assignees
Labels
arch-wasm WebAssembly architecture area-VM-meta-mono
Milestone

Comments

@macriluis
Copy link

Describe the bug

Using a Windows PC, you set your Time Zone as (UTC-03:00) City of Buenos Aires
In Blazor WebAssembly client, the Time Zone is UTC.

To Reproduce

Create a new Blazor WebAssembly app.

In Index.razor add:

Your Time: @DateTime.Now.ToString()
Your Time Zone: @TimeZoneInfo.Local.DisplayName

In Control Panel or Configuration, set the Time Zone as (UTC-03:00) City of Buenos Aires
In Blazor WebAssembly client, the Time zone is UTC.
Wrong.

Further technical details

  • ASP.NET Core version
  • Include the output of dotnet --info

SDK de .NET Core (reflejando cualquier global.json):
Version: 5.0.100-rc.2.20479.15
Commit: da7dfa8840

Entorno de tiempo de ejecución:
OS Name: Windows
OS Version: 10.0.18363
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\5.0.100-rc.2.20479.15\

Host (useful for support):
Version: 5.0.0-rc.2.20475.5
Commit: c5a3f49

.NET SDKs installed:
3.1.300-preview-015115 [C:\Program Files\dotnet\sdk]
3.1.400-preview-015151 [C:\Program Files\dotnet\sdk]
3.1.403 [C:\Program Files\dotnet\sdk]
5.0.100-rc.2.20479.15 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.21 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.21 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0-rc.2.20475.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.21 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.0-rc.2.20475.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.0-rc.2.20475.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

  • The IDE (VS / VS Code/ VS4Mac) you're running on, and it's version
    Visual Studio 2019 16.8 Preview 4

net5rc2

@pranavkm pranavkm transferred this issue from dotnet/aspnetcore Oct 16, 2020
@Dotnet-GitSync-Bot
Copy link
Collaborator

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added the untriaged New issue has not been triaged by the area owner label Oct 16, 2020
@pranavkm
Copy link
Contributor

@lewing \ @kjpou1 looks like something's amiss with the TZ database. The TZ value is America/Buenos_Aires for the location. On my Ubuntu machine, a /usr/share/zoneinfo/America/Buenos_Aires but not in the TZ file carried by .NET.

@lewing lewing added the arch-wasm WebAssembly architecture label Oct 16, 2020
@lewing
Copy link
Member

lewing commented Oct 16, 2020

/cc @tqiu8

@ghost
Copy link

ghost commented Oct 17, 2020

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

@lewing lewing added this to the 6.0.0 milestone Oct 17, 2020
@lewing lewing removed the untriaged New issue has not been triaged by the area owner label Oct 17, 2020
@macriluis
Copy link
Author

@lewing Is there a workaround for this?
The only way I have found, is to tell the users to change the TimeZone in their computers.
But, this is not working good, some users forget to do it, others simply does not want to do that change.
I need to use the TimeZone (-3) for Argentina.
Thanks in advance.

@lewing
Copy link
Member

lewing commented Oct 19, 2020

@macriluis what does Intl.DateTimeFormat().resolvedOptions().timeZone print from the javascript console on those machines?

@pranavkm
Copy link
Contributor

@lewing on my machine it prints America/Buenos_Aires

@macriluis
Copy link
Author

@lewing on my machine, Windows 10, using Edge or Chrome the javascript console says America/Buenos_Aires

@tqiu8
Copy link
Contributor

tqiu8 commented Oct 19, 2020

So the timezone id given by the browser (Intl.DateTimeFormat().resolvedOptions().timeZone) is different from the id used by the tz data (e.g. America/Buenos_Aires in browser, vs America/Argentina/Buenos_Aires in tzdb). This problem extends to any other timezone that has three levels instead of two.

@lewing
Copy link
Member

lewing commented Oct 24, 2020

@macriluis the issue appears to be solvable by replacing the dotnet.timezones.blat file from the runtime pack with the eventual result of #43786

We'll backport the fix once everything is verified.

@macriluis
Copy link
Author

@lewing thank you very much!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-VM-meta-mono
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants