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

Blazor WASM .NET 5 TimeZoneInfo DaylightName values not correct #45136

Closed
jgilm opened this issue Nov 24, 2020 · 11 comments · Fixed by #45385
Closed

Blazor WASM .NET 5 TimeZoneInfo DaylightName values not correct #45136

jgilm opened this issue Nov 24, 2020 · 11 comments · Fixed by #45385
Labels
arch-wasm WebAssembly architecture area-System.DateTime
Milestone

Comments

@jgilm
Copy link

jgilm commented Nov 24, 2020

Description

Using Blazor WASM with .NET 5, the information in TimeZoneInfo.DaylightName is incorrect and appears to mirror the TimeZoneInfo.StandardName.

Actual Behavior:

TimeZoneInfo.DaylightName is identical to TimeZoneInfo.StandardName.
For example using this code

                @foreach (var tz in TimeZoneInfo.GetSystemTimeZones().OrderBy(tz => tz.BaseUtcOffset))
                {
                    <tr>
                        <td>@tz.Id</td><td>@tz.DisplayName</td><td>@tz.StandardName</td>
                        <td>@tz.SupportsDaylightSavingTime</td><td>@tz.DaylightName</td>
                        <td>@tz.BaseUtcOffset</td>
                    </tr>
                }

produces

image

Expected Behavior:

TimeZoneInfo.DaylightName is different (and correct) for time zones that support daylight saving time.
For example, in a .NET 5 console application the same values look like this:

image
Pacific Standard time in a .NET 5 console app shows that the StandardName is "Pacific Standard Time" and the DaylightName is "Pacific Daylight Time"

This may be partially related to #44840

Configuration

  • NET 5
  • Blazor WASM
  • Windows 10
  • Chrome 86
  • Project settings looks like this:
  <PropertyGroup>
    <TargetFramework>net5.0</TargetFramework>
    <ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
    <BlazorWebAssemblyLoadAllGlobalizationData>true</BlazorWebAssemblyLoadAllGlobalizationData>
  </PropertyGroup>

Regression?

This is a regression from Blazor WASM 3.2, which produces this result
image

Other information

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added the untriaged New issue has not been triaged by the area owner label Nov 24, 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.

@ghost
Copy link

ghost commented Nov 24, 2020

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

Issue Details

Description

Using Blazor WASM with .NET 5, the information in TimeZoneInfo.DaylightName is incorrect and appears to mirror the TimeZoneInfo.StandardName.

Actual Behavior:

TimeZoneInfo.DaylightName is identical to TimeZoneInfo.StandardName.
For example using this code

                @foreach (var tz in TimeZoneInfo.GetSystemTimeZones().OrderBy(tz => tz.BaseUtcOffset))
                {
                    <tr>
                        <td>@tz.Id</td><td>@tz.DisplayName</td><td>@tz.StandardName</td>
                        <td>@tz.SupportsDaylightSavingTime</td><td>@tz.DaylightName</td>
                        <td>@tz.BaseUtcOffset</td>
                    </tr>
                }

produces

image

Expected Behavior:

TimeZoneInfo.DaylightName is different (and correct) for time zones that support daylight saving time.
For example, in a .NET 5 console application the same values look like this:

image
Pacific Standard time in a .NET 5 console app shows that the StandardName is "Pacific Standard Time" and the DaylightName is "Pacific Daylight Time"

This may be partially related to #44840

Configuration

  • NET 5
  • Blazor WASM
  • Windows 10
  • Chrome 86
  • Project settings looks like this:
  <PropertyGroup>
    <TargetFramework>net5.0</TargetFramework>
    <ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
    <BlazorWebAssemblyLoadAllGlobalizationData>true</BlazorWebAssemblyLoadAllGlobalizationData>
  </PropertyGroup>

Regression?

This is a regression from Blazor WASM 3.2, which produces this result
image

Other information

Author: jgilm
Assignees: -
Labels:

arch-wasm, area-System.Globalization, untriaged

Milestone: -

@marek-safar
Copy link
Contributor

/cc @lewing

@lewing
Copy link
Member

lewing commented Nov 24, 2020

@tqiu8 can you test the example on unix as well and make sure all the other issues are already tracked/resolved

@radical
Copy link
Member

radical commented Nov 24, 2020

Just curious, do we have tests for this?

@safern
Copy link
Member

safern commented Nov 25, 2020

Just curious, do we have tests for this?

I just searched for that and it seems like we don't for WASM, the one we have uses RemoteExecutor, hence it is skipped on WASM.

@lewing
Copy link
Member

lewing commented Nov 25, 2020

Looks like there is some crossover here with #16232 ?

@tqiu8
Copy link
Contributor

tqiu8 commented Nov 25, 2020

Yea it looks like the DaylightName and StandardName are the same in unix. Also the display name is basically of the format (UTC+<diff>) StandardName as well

@lewing lewing removed the untriaged New issue has not been triaged by the area owner label Nov 25, 2020
@lewing lewing added this to the 6.0.0 milestone Nov 25, 2020
@lewing
Copy link
Member

lewing commented Nov 25, 2020

I think we've found the issue with DaylightName and a fix is in progress. The StandardName/DisplayName commonality is #16232
It is different from 3.2 because the core libraries have changed.

@tarekgh
Copy link
Member

tarekgh commented Nov 26, 2020

@lewing how did we use to get the display name in 3.2? did we carry the data back then?

@lewing
Copy link
Member

lewing commented Nov 26, 2020

@tarekgh I haven't verified the code but 3.2 Wasm used the mono/mono bcl with different timezone code which likely carried this data with it for compatibility with windows. I can double check next week.

@ghost ghost locked as resolved and limited conversation to collaborators Apr 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-System.DateTime
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants