Skip to content

Commit

Permalink
Upgrade Blazor to v.0.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jsakamoto committed Feb 8, 2019
1 parent 2f76d86 commit 4974f37
Show file tree
Hide file tree
Showing 10 changed files with 71 additions and 70 deletions.
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This package provides system time zones set, and local time zone initialization,

### Note

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.
At this time, the version of Blazor is v.0.8.0 or before, those doesn't contain any time zone info, and local time zone is always UTC wherever.

See also:

Expand All @@ -35,7 +35,7 @@ using Toolbelt.Blazor.Extensions.DependencyInjection;
public class Startup
{
...
public void Configure(IBlazorApplicationBuilder app)
public void Configure(IComponentsApplicationBuilder app)
{
app.UseLocalTimeZone();
...
Expand All @@ -62,6 +62,18 @@ And, this library also contains mapping information for converting IANA time zon
- **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.)

## Release Note

- **v.3.0.0** - BREAKING CHANGE: Support Blazor v.0.8.0 (not compatible with v.0.7.0 or before.)
- **v.2.1.0**
- Blazor v.0.6.0 support - it was signed strong name.
- Update time zone information
- Morocco Standard Time
- Namibia Standard Time
- Fiji Standard Time
- **v.2.0.0** - BREAKING CHANGE: Fix namespace of TimeZoneKitExtension class.
- **v.1.0.0** - 1st release.

## License

[Mozilla Public License Version 2.0](LICENSE)
[Mozilla Public License Version 2.0](https://raw.githubusercontent.com/jsakamoto/Toolbelt.Blazor.TimeZoneKit/master/LICENSE)
4 changes: 2 additions & 2 deletions Toolbelt.Blazor.TimeZoneKit.Sample/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Microsoft.AspNetCore.Blazor.Builder;
using Microsoft.AspNetCore.Components.Builder;
using Microsoft.Extensions.DependencyInjection;
using Toolbelt.Blazor.Extensions.DependencyInjection;

Expand All @@ -10,7 +10,7 @@ public void ConfigureServices(IServiceCollection services)
{
}

public void Configure(IBlazorApplicationBuilder app)
public void Configure(IComponentsApplicationBuilder app)
{
app.UseLocalTimeZone();
app.AddComponent<App>("app");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,14 @@
<RunCommand>dotnet</RunCommand>
<RunArguments>blazor serve</RunArguments>
<LangVersion>7.3</LangVersion>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Blazor.Browser" Version="0.7.0-preview1-final" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="0.7.0-preview1-final" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Blazor" Version="0.8.0-preview-19104-04" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="0.8.0-preview-19104-04" PrivateAssets="all" />
<PackageReference Include="Toolbelt.Blazor.TimeZoneKit" Version="3.0.0" />

<DotNetCliToolReference Include="Microsoft.AspNetCore.Blazor.Cli" Version="0.7.0-preview1-final" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Toolbelt.Blazor.TimeZoneKit\Toolbelt.Blazor.TimeZoneKit.csproj" />
<DotNetCliToolReference Include="Microsoft.AspNetCore.Blazor.Cli" Version="0.8.0-preview-19104-04" />
</ItemGroup>

</Project>

This file was deleted.

6 changes: 3 additions & 3 deletions Toolbelt.Blazor.TimeZoneKit.Sample/_ViewImports.cshtml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@using System.Net.Http
@using Microsoft.AspNetCore.Blazor.Layouts
@using Microsoft.AspNetCore.Blazor.Routing
@using System.Net.Http
@using Microsoft.AspNetCore.Components.Layouts
@using Microsoft.AspNetCore.Components.Routing
@using Microsoft.JSInterop
@using Toolbelt.Blazor.TimeZoneKit.Sample
6 changes: 3 additions & 3 deletions Toolbelt.Blazor.TimeZoneKit.Sample/wwwroot/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width">
<meta name="viewport" content="width=device-width" />
<title>Toolbelt.Blazor.TimeZoneKit - Sample</title>
<base href="/" />
<link href="css/site.css" rel="stylesheet" />
</head>
<body>
<app>Loading...</app>

<script src="_framework/blazor.webassembly.js"></script>
<script src="_framework/components.webassembly.js"></script>
</body>
</html>
</html>
10 changes: 5 additions & 5 deletions Toolbelt.Blazor.TimeZoneKit/Extension.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System;
using Microsoft.AspNetCore.Blazor.Builder;
using Microsoft.AspNetCore.Components.Builder;
using Microsoft.JSInterop;

namespace Toolbelt.Blazor.Extensions.DependencyInjection
Expand All @@ -12,7 +12,7 @@ public static class TimeZoneKitExtension
/// <summary>
/// Set "TimeZoneInfo.Local" to actual local time zone. (include "UseSystemTimeZones()")
/// </summary>
public static void UseLocalTimeZone(this IBlazorApplicationBuilder app)
public static void UseLocalTimeZone(this IComponentsApplicationBuilder app)
{
app.UseSystemTimeZones();
JSRuntime.Current.InvokeAsync<string>("eval", "DotNet.invokeMethod('Toolbelt.Blazor.TimeZoneKit','InitLocalTimeZone', (function(){try { return ''+ Intl.DateTimeFormat().resolvedOptions().timeZone; } catch(e) {} return 'UTC';}()))");
Expand All @@ -21,7 +21,7 @@ public static void UseLocalTimeZone(this IBlazorApplicationBuilder app)
/// <summary>
/// Set "TimeZoneInfo.Local" to the time zone that specified id. (include "UseSystemTimeZones()")
/// </summary>
public static void UseLocalTimeZone(this IBlazorApplicationBuilder app, string timeZoneId)
public static void UseLocalTimeZone(this IComponentsApplicationBuilder app, string timeZoneId)
{
app.UseSystemTimeZones();
TimeZoneKit.TimeZoneKit.SetLocalTimeZone(timeZoneId);
Expand All @@ -30,7 +30,7 @@ public static void UseLocalTimeZone(this IBlazorApplicationBuilder app, string t
/// <summary>
/// Set "TimeZoneInfo.Local" to the time zone that specified IANA name. (include "UseSystemTimeZones()")
/// </summary>
public static void UseLocalTimeZoneByIANAName(this IBlazorApplicationBuilder app, string ianaTimeZoneName)
public static void UseLocalTimeZoneByIANAName(this IComponentsApplicationBuilder app, string ianaTimeZoneName)
{
app.UseSystemTimeZones();
TimeZoneKit.TimeZoneKit.SetLocalTimeZoneByIANAName(ianaTimeZoneName);
Expand All @@ -39,7 +39,7 @@ public static void UseLocalTimeZoneByIANAName(this IBlazorApplicationBuilder app
/// <summary>
/// Ensure "TimeZoneInfo.GetSystemTimeZones()"
/// </summary>
public static void UseSystemTimeZones(this IBlazorApplicationBuilder app)
public static void UseSystemTimeZones(this IComponentsApplicationBuilder app)
{
if (TimeZoneInfo.GetSystemTimeZones().Count == 0)
{
Expand Down
44 changes: 27 additions & 17 deletions Toolbelt.Blazor.TimeZoneKit/TimeZoneKit.CreateSystemTimeZones.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public static TimeZoneInfo[] CreateSystemTimeZones()
R(635556672000000000, 635871168000000000, 36000000000, T(72000000000, 3, 2, DayOfWeek.Sunday), T(0, 1, 1, DayOfWeek.Thursday), 0),
R(635872032000000000, 636187392000000000, 0, T(0, 1, 1), T(10000, 1, 1), 36000000000),
R(636188256000000000, 636502752000000000, 0, T(0, 1, 1), T(10000, 1, 1), 36000000000),
R(636503616000000000, 636818112000000000, 36000000000, T(0, 1, 1, DayOfWeek.Monday), T(72000000000, 11, 1, DayOfWeek.Sunday), 0),
R(636503616000000000, 636818112000000000, 36000000000, T(72000000000, 3, 2, DayOfWeek.Sunday), T(72000000000, 11, 1, DayOfWeek.Sunday), 0),
R(636818976000000000, 3155378112000000000, 36000000000, T(72000000000, 3, 2, DayOfWeek.Sunday), T(72000000000, 11, 1, DayOfWeek.Sunday), 0),
}),
TZ("Paraguay Standard Time", -144000000000, "(UTC-04:00) Asuncion", "Paraguay Standard Time", "Paraguay Daylight Time", new AdjustmentRule[] {
Expand Down Expand Up @@ -300,20 +300,6 @@ public static TimeZoneInfo[] CreateSystemTimeZones()
}),
TZ("Cape Verde Standard Time", -36000000000, "(UTC-01:00) Cabo Verde Is.", "Cabo Verde Standard Time", "Cabo Verde Daylight Time", null),
TZ("UTC", 0, "(UTC) Coordinated Universal Time", "Coordinated Universal Time", "Coordinated Universal Time", null),
TZ("Morocco Standard Time", 0, "(UTC+00:00) Casablanca", "Morocco Standard Time", "Morocco Daylight Time", new AdjustmentRule[] {
R(633347424000000000, 633662784000000000, 36000000000, T(863999990000, 5, 5, DayOfWeek.Saturday), T(863999990000, 8, 5, DayOfWeek.Sunday), 0),
R(633663648000000000, 633978144000000000, 36000000000, T(863999990000, 5, 5, DayOfWeek.Sunday), T(863999990000, 8, 3, DayOfWeek.Thursday), 0),
R(633979008000000000, 634293504000000000, 36000000000, T(863999990000, 5, 1, DayOfWeek.Saturday), T(863999990000, 8, 1, DayOfWeek.Saturday), 0),
R(634294368000000000, 634608864000000000, 36000000000, T(863999990000, 4, 1, DayOfWeek.Saturday), T(863999990000, 7, 5, DayOfWeek.Saturday), 0),
R(634609728000000000, 634925088000000000, 36000000000, T(72000000000, 4, 5, DayOfWeek.Sunday), T(108000000000, 9, 5, DayOfWeek.Sunday), 0),
R(634925952000000000, 635240448000000000, 36000000000, T(72000000000, 4, 5, DayOfWeek.Sunday), T(108000000000, 10, 5, DayOfWeek.Sunday), 0),
R(635241312000000000, 635555808000000000, 36000000000, T(72000000000, 3, 5, DayOfWeek.Sunday), T(108000000000, 10, 5, DayOfWeek.Sunday), 0),
R(635556672000000000, 635871168000000000, 36000000000, T(72000000000, 3, 5, DayOfWeek.Sunday), T(108000000000, 10, 5, DayOfWeek.Sunday), 0),
R(635872032000000000, 636187392000000000, 36000000000, T(72000000000, 3, 5, DayOfWeek.Sunday), T(108000000000, 10, 5, DayOfWeek.Sunday), 0),
R(636188256000000000, 636502752000000000, 36000000000, T(72000000000, 3, 5, DayOfWeek.Sunday), T(108000000000, 10, 5, DayOfWeek.Sunday), 0),
R(636503616000000000, 636818112000000000, 36000000000, T(72000000000, 3, 5, DayOfWeek.Sunday), T(108000000000, 10, 5, DayOfWeek.Sunday), 0),
R(636818976000000000, 3155378112000000000, 36000000000, T(72000000000, 3, 5, DayOfWeek.Sunday), T(108000000000, 10, 4, DayOfWeek.Sunday), 0),
}),
TZ("GMT Standard Time", 0, "(UTC+00:00) Dublin, Edinburgh, Lisbon, London", "GMT Standard Time", "GMT Daylight Time", new AdjustmentRule[] {
R(0, 3155378112000000000, 36000000000, T(36000000000, 3, 5, DayOfWeek.Sunday), T(72000000000, 10, 5, DayOfWeek.Sunday), 0),
}),
Expand All @@ -327,6 +313,20 @@ public static TimeZoneInfo[] CreateSystemTimeZones()
TZ("Romance Standard Time", 36000000000, "(UTC+01:00) Brussels, Copenhagen, Madrid, Paris", "Romance Standard Time", "Romance Daylight Time", new AdjustmentRule[] {
R(0, 3155378112000000000, 36000000000, T(72000000000, 3, 5, DayOfWeek.Sunday), T(108000000000, 10, 5, DayOfWeek.Sunday), 0),
}),
TZ("Morocco Standard Time", 36000000000, "(UTC+01:00) Casablanca", "Morocco Standard Time", "Morocco Daylight Time", new AdjustmentRule[] {
R(0, 633346560000000000, 0, T(0, 1, 1), T(10000, 1, 1), -36000000000),
R(633347424000000000, 633662784000000000, 36000000000, T(863999990000, 5, 5, DayOfWeek.Saturday), T(863999990000, 8, 5, DayOfWeek.Sunday), -36000000000),
R(633663648000000000, 633978144000000000, 36000000000, T(863999990000, 5, 5, DayOfWeek.Sunday), T(863999990000, 8, 3, DayOfWeek.Thursday), -36000000000),
R(633979008000000000, 634293504000000000, 36000000000, T(863999990000, 5, 1, DayOfWeek.Saturday), T(863999990000, 8, 1, DayOfWeek.Saturday), -36000000000),
R(634294368000000000, 634608864000000000, 36000000000, T(863999990000, 4, 1, DayOfWeek.Saturday), T(863999990000, 7, 5, DayOfWeek.Saturday), -36000000000),
R(634609728000000000, 634925088000000000, 36000000000, T(72000000000, 4, 5, DayOfWeek.Sunday), T(108000000000, 9, 5, DayOfWeek.Sunday), -36000000000),
R(634925952000000000, 635240448000000000, 36000000000, T(72000000000, 4, 5, DayOfWeek.Sunday), T(108000000000, 10, 5, DayOfWeek.Sunday), -36000000000),
R(635241312000000000, 635555808000000000, 36000000000, T(72000000000, 3, 5, DayOfWeek.Sunday), T(108000000000, 10, 5, DayOfWeek.Sunday), -36000000000),
R(635556672000000000, 635871168000000000, 36000000000, T(72000000000, 3, 5, DayOfWeek.Sunday), T(108000000000, 10, 5, DayOfWeek.Sunday), -36000000000),
R(635872032000000000, 636187392000000000, 36000000000, T(72000000000, 3, 5, DayOfWeek.Sunday), T(108000000000, 10, 5, DayOfWeek.Sunday), -36000000000),
R(636188256000000000, 636502752000000000, 36000000000, T(72000000000, 3, 5, DayOfWeek.Sunday), T(108000000000, 10, 5, DayOfWeek.Sunday), -36000000000),
R(636503616000000000, 636818112000000000, 36000000000, T(72000000000, 6, 3, DayOfWeek.Sunday), T(0, 1, 1, DayOfWeek.Monday), -36000000000),
}),
TZ("Sao Tome Standard Time", 36000000000, "(UTC+01:00) Sao Tome", "Sao Tome Standard Time", "Sao Tome Daylight Time", new AdjustmentRule[] {
R(0, 636502752000000000, 0, T(0, 1, 1), T(10000, 1, 1), -36000000000),
R(636503616000000000, 636818112000000000, -36000000000, T(0, 1, 1, DayOfWeek.Monday), T(36000000000, 1, 1, DayOfWeek.Monday), 0),
Expand Down Expand Up @@ -463,7 +463,7 @@ public static TimeZoneInfo[] CreateSystemTimeZones()
R(0, 634293504000000000, 36000000000, T(72000000000, 3, 5, DayOfWeek.Sunday), T(108000000000, 10, 5, DayOfWeek.Sunday), -36000000000),
R(634294368000000000, 634608864000000000, 36000000000, T(72000000000, 3, 5, DayOfWeek.Sunday), T(0, 1, 1, DayOfWeek.Saturday), -36000000000),
}),
TZ("Russian Standard Time", 108000000000, "(UTC+03:00) Moscow, St. Petersburg, Volgograd", "Russia TZ 2 Standard Time", "Russia TZ 2 Daylight Time", new AdjustmentRule[] {
TZ("Russian Standard Time", 108000000000, "(UTC+03:00) Moscow, St. Petersburg", "Russia TZ 2 Standard Time", "Russia TZ 2 Daylight Time", new AdjustmentRule[] {
R(0, 634293504000000000, 36000000000, T(72000000000, 3, 5, DayOfWeek.Sunday), T(108000000000, 10, 5, DayOfWeek.Sunday), 0),
R(634294368000000000, 634608864000000000, 36000000000, T(72000000000, 3, 5, DayOfWeek.Sunday), T(0, 1, 1, DayOfWeek.Saturday), 0),
R(634609728000000000, 634925088000000000, 0, T(0, 1, 1), T(10000, 1, 1), 36000000000),
Expand Down Expand Up @@ -520,6 +520,15 @@ public static TimeZoneInfo[] CreateSystemTimeZones()
R(635872032000000000, 636187392000000000, -36000000000, T(0, 1, 1, DayOfWeek.Friday), T(72000000000, 12, 1, DayOfWeek.Sunday), 0),
}),
TZ("Georgian Standard Time", 144000000000, "(UTC+04:00) Tbilisi", "Georgian Standard Time", "Georgian Daylight Time", null),
TZ("Volgograd Standard Time", 144000000000, "(UTC+04:00) Volgograd", "Volgograd Standard Time", "Volgograd Daylight Time", new AdjustmentRule[] {
R(0, 634293504000000000, 36000000000, T(72000000000, 3, 5, DayOfWeek.Sunday), T(108000000000, 10, 5, DayOfWeek.Sunday), -36000000000),
R(634294368000000000, 634608864000000000, 36000000000, T(72000000000, 3, 5, DayOfWeek.Sunday), T(0, 1, 1, DayOfWeek.Saturday), -36000000000),
R(635241312000000000, 635555808000000000, 36000000000, T(0, 1, 1, DayOfWeek.Wednesday), T(72000000000, 10, 5, DayOfWeek.Sunday), -36000000000),
R(635556672000000000, 635871168000000000, 0, T(0, 1, 1), T(10000, 1, 1), -36000000000),
R(635872032000000000, 636187392000000000, 0, T(0, 1, 1), T(10000, 1, 1), -36000000000),
R(636188256000000000, 636502752000000000, 0, T(0, 1, 1), T(10000, 1, 1), -36000000000),
R(636503616000000000, 636818112000000000, -36000000000, T(0, 1, 1, DayOfWeek.Monday), T(72000000000, 10, 5, DayOfWeek.Sunday), 0),
}),
TZ("Caucasus Standard Time", 144000000000, "(UTC+04:00) Yerevan", "Caucasus Standard Time", "Caucasus Daylight Time", new AdjustmentRule[] {
R(0, 634608864000000000, 36000000000, T(72000000000, 3, 5, DayOfWeek.Sunday), T(108000000000, 10, 5, DayOfWeek.Sunday), 0),
}),
Expand Down Expand Up @@ -712,7 +721,8 @@ public static TimeZoneInfo[] CreateSystemTimeZones()
R(635872032000000000, 636187392000000000, 36000000000, T(72000000000, 11, 1, DayOfWeek.Sunday), T(108000000000, 1, 3, DayOfWeek.Sunday), 0),
R(636188256000000000, 636502752000000000, 36000000000, T(72000000000, 11, 1, DayOfWeek.Sunday), T(108000000000, 1, 3, DayOfWeek.Sunday), 0),
R(636503616000000000, 636818112000000000, 36000000000, T(72000000000, 11, 1, DayOfWeek.Sunday), T(108000000000, 1, 2, DayOfWeek.Sunday), 0),
R(636818976000000000, 3155378112000000000, 36000000000, T(72000000000, 11, 1, DayOfWeek.Sunday), T(108000000000, 1, 3, DayOfWeek.Sunday), 0),
R(636818976000000000, 637133472000000000, 36000000000, T(72000000000, 11, 1, DayOfWeek.Sunday), T(108000000000, 1, 2, DayOfWeek.Sunday), 0),
R(637134336000000000, 3155378112000000000, 36000000000, T(72000000000, 11, 1, DayOfWeek.Sunday), T(108000000000, 1, 3, DayOfWeek.Sunday), 0),
}),
TZ("Kamchatka Standard Time", 432000000000, "(UTC+12:00) Petropavlovsk-Kamchatsky - Old", "Kamchatka Standard Time", "Kamchatka Daylight Time", new AdjustmentRule[] {
R(0, 3155378112000000000, 36000000000, T(72000000000, 3, 5, DayOfWeek.Sunday), T(108000000000, 10, 5, DayOfWeek.Sunday), 0),
Expand Down
Loading

0 comments on commit 4974f37

Please sign in to comment.