Skip to content

Commit 89dd4b0

Browse files
committed
Default the timezone to UTC if it is not resolved.
Browsers may not correctly resolve the machine's timezone in some cases. In the current implementation, this results in an exception being thrown by .NET Core (WASM). This code defaults the timezone to UTC when the timezone cannot be resolved. Fixes dotnet/runtime#44154 Port of #27444
1 parent 80f8669 commit 89dd4b0

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/Components/Web.JS/dist/Release/blazor.server.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Components/Web.JS/dist/Release/blazor.webassembly.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Components/Web.JS/src/Platform/Mono/MonoPlatform.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ function createEmscriptenModuleInstance(resourceLoader: WebAssemblyResourceLoade
425425
try {
426426
timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
427427
} catch { }
428-
MONO.mono_wasm_setenv("TZ", timeZone);
428+
MONO.mono_wasm_setenv("TZ", timeZone || 'UTC');
429429
// Turn off full-gc to prevent browser freezing.
430430
const mono_wasm_enable_on_demand_gc = cwrap('mono_wasm_enable_on_demand_gc', null, ['number']);
431431
mono_wasm_enable_on_demand_gc(0);

0 commit comments

Comments
 (0)