{
mono_wasm_enable_gc = enable ? 1 : 0;
}
-
-// Returns the local timezone default is UTC.
-EM_JS(size_t, mono_wasm_timezone_get_local_name, (),
-{
- var res = "UTC";
- try {
- res = Intl.DateTimeFormat().resolvedOptions().timeZone;
- } catch(e) {}
-
- var buff = Module._malloc((res.length + 1) * 2);
- stringToUTF16 (res, buff, (res.length + 1) * 2);
- return buff;
-})
-
-void
-mono_timezone_get_local_name (MonoString **result)
-{
- // WASM returns back an int pointer to a string UTF16 buffer.
- // We then cast to `mono_unichar2*`. Returning `mono_unichar2*` from the JavaScript call will
- // result in cast warnings from the compiler.
- mono_unichar2 *tzd_local_name = (mono_unichar2*)mono_wasm_timezone_get_local_name ();
- *result = mono_string_from_utf16 (tzd_local_name);
- free (tzd_local_name);
-}
load_runtime ("unused", args.debug_level);
}
+ let tz;
+ try {
+ tz = Intl.DateTimeFormat().resolvedOptions().timeZone;
+ } catch {}
+ MONO.mono_wasm_setenv ("TZ", tz || "UTC");
MONO.mono_wasm_runtime_ready ();
args.loaded_cb ();
},