Skip to content

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

@jgilm

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions