Skip to content

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

Closed

Description

@jgilm

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

Activity

  1. added
    untriaged
    on Nov 24, 2020
  2. Dotnet-GitSync-Bot commented on Nov 24, 2020

    @Dotnet-GitSync-Bot
    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.

  3. marek-safar commented on Nov 24, 2020

    @marek-safar
    Contributor
  4. lewing commented on Nov 24, 2020

    @lewing
    Member

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

  5. radical commented on Nov 24, 2020

    @radical
    Member

    Just curious, do we have tests for this?

  6. safern commented on Nov 25, 2020

    @safern
    Member

    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.

  7. lewing commented on Nov 25, 2020

    @lewing
    Member

    Looks like there is some crossover here with #16232 ?

  8. tqiu8 commented on Nov 25, 2020

    @tqiu8
    Contributor

    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

  9. removed
    untriaged
    on Nov 25, 2020
  10. added this to the 6.0.0 milestone on Nov 25, 2020
  11. lewing commented on Nov 25, 2020

    @lewing
    Member

    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.

  12. tarekgh commented on Nov 26, 2020

    @tarekgh
    Member

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

  13. lewing commented on Nov 26, 2020

    @lewing
    Member

    @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.

  14. ghost locked as resolved and limited conversation to collaborators on Apr 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    arch-wasmarea-System.DateTime

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions