diff --git a/src/Coalesce.Web.Vue/Startup.cs b/src/Coalesce.Web.Vue/Startup.cs index d38f8cb28..c01a751ab 100644 --- a/src/Coalesce.Web.Vue/Startup.cs +++ b/src/Coalesce.Web.Vue/Startup.cs @@ -1,4 +1,5 @@ using System; +using System.Runtime.InteropServices; using Coalesce.Domain; using IntelliTect.Coalesce; using IntelliTect.Coalesce.DataAnnotations; @@ -30,12 +31,18 @@ public void ConfigureServices(IServiceCollection services) services.AddDbContext(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"))); - services.AddCoalesce(builder => builder - .AddContext() - .UseDefaultDataSource(typeof(MyDataSource<,>)) - .UseDefaultBehaviors(typeof(MyBehaviors<,>)) - .UseTimeZone(TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time")) - ); + services.AddCoalesce(builder => + { + builder + .AddContext() + .UseDefaultDataSource(typeof(MyDataSource<,>)) + .UseDefaultBehaviors(typeof(MyBehaviors<,>)); + + // This breaks on non-windows platforms, see https://github.com/dotnet/corefx/issues/11897 + builder.UseTimeZone(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) + ? TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time") + : TimeZoneInfo.FindSystemTimeZoneById("America/Los_Angeles")); + }); services.AddAuthentication(DemoMiddleware.AuthenticationScheme).AddCookie(DemoMiddleware.AuthenticationScheme); diff --git a/src/Coalesce.Web/Startup.cs b/src/Coalesce.Web/Startup.cs index 09513b393..748dae4d4 100644 --- a/src/Coalesce.Web/Startup.cs +++ b/src/Coalesce.Web/Startup.cs @@ -9,6 +9,7 @@ using Newtonsoft.Json.Serialization; using Newtonsoft.Json; using System; +using System.Runtime.InteropServices; using IntelliTect.Coalesce; using Coalesce.Domain.Services; using Microsoft.AspNetCore.Mvc; @@ -39,12 +40,18 @@ public void ConfigureServices(IServiceCollection services) services.AddDbContext(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"))); - services.AddCoalesce(builder => builder - .AddContext() - .UseDefaultDataSource(typeof(MyDataSource<,>)) - .UseDefaultBehaviors(typeof(MyBehaviors<,>)) - .UseTimeZone(TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time")) - ); + services.AddCoalesce(builder => + { + builder + .AddContext() + .UseDefaultDataSource(typeof(MyDataSource<,>)) + .UseDefaultBehaviors(typeof(MyBehaviors<,>)); + + // This breaks on non-windows platforms, see https://github.com/dotnet/corefx/issues/11897 + builder.UseTimeZone(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) + ? TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time") + : TimeZoneInfo.FindSystemTimeZoneById("America/Los_Angeles")); + }); services.AddCors();