Default the timezone to UTC if it is not resolved. (#27505)
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 https://github.com/dotnet/runtime/issues/44154 Port of https://github.com/dotnet/aspnetcore/pull/27444 Co-authored-by: Artak <34246760+mkArtakMSFT@users.noreply.github.com>
This commit is contained in:
parent
cdd67cb443
commit
26c2891c60
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -425,7 +425,7 @@ function createEmscriptenModuleInstance(resourceLoader: WebAssemblyResourceLoade
|
|||
try {
|
||||
timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
||||
} catch { }
|
||||
MONO.mono_wasm_setenv("TZ", timeZone);
|
||||
MONO.mono_wasm_setenv("TZ", timeZone || 'UTC');
|
||||
// Turn off full-gc to prevent browser freezing.
|
||||
const mono_wasm_enable_on_demand_gc = cwrap('mono_wasm_enable_on_demand_gc', null, ['number']);
|
||||
mono_wasm_enable_on_demand_gc(0);
|
||||
|
|
|
|||
Loading…
Reference in New Issue