No description, website, or topics provided.
Switch branches/tags
Clone or download
Latest commit b302a8e Oct 3, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.

Blazor Time Zone Kit NuGet Package


This is a class library as a NuGet package for Blazor browser application.

This package provides system time zones set, and local time zone initialization, for Blazor browser application.

fig. 1


At this time, the version of Blazor is v.0.6.0, it doesn't contain any time zone info, and local time zone is always UTC wherever.

See also:

How to install and use it?

Step.1 - Install this package.

> dotnet add package Toolbelt.Blazor.TimeZoneKit

Step.2 - call UseLocalTimeZone() extension method in Configure() method of startup class.

using Toolbelt.Blazor.Extensions.DependencyInjection;

public class Startup
    public void Configure(IBlazorApplicationBuilder app)

That's all!

How does it work?

There is no magic.

This library contains all the system time zone information as a C# code.
(see: "TimeZoneKit.CreateSystemTimeZones.cs")

And, this library also contains mapping information for converting IANA time zone names to .NET time zone IDs.
(see: "TimeZoneKit.IANAtoTZIdMap.cs")

UseLocalTimeZone() extension method in this library invokes "Intl.DateTimeFormat().resolvedOptions().timeZone" JavaScript code to get the current time zone name (IANA name) on the web browser.

UseLocalTimeZone() extension method also set up the system time zone set and local time zone information by accessing undocumented / non public members in System.TimeZoneInfo class.


  • WARNING - This library accesses private members of System.TimeZoneInfo using the "Reflection" .NET API, so it may break in future .NET runtime (mono.wasm) release.
  • In my test case, this package increased the size of the sample Blazor browser application content by 154 KB. (by 20KB gzip transfer.)


Mozilla Public License Version 2.0