diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/Marshaling/JSMarshalerArgument.DateTime.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/Marshaling/JSMarshalerArgument.DateTime.cs index 575139fa8cf07f..8b1674eecd789e 100644 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/Marshaling/JSMarshalerArgument.DateTime.cs +++ b/src/libraries/System.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/Marshaling/JSMarshalerArgument.DateTime.cs @@ -107,7 +107,7 @@ public void ToManaged(out DateTime value) public void ToJS(DateTime value) { slot.Type = MarshalerType.DateTime; - slot.DoubleValue = new DateTimeOffset(value).ToUnixTimeMilliseconds(); + slot.DoubleValue = new DateTimeOffset(value.Ticks, TimeSpan.Zero).ToUnixTimeMilliseconds(); } /// @@ -141,7 +141,7 @@ public void ToJS(DateTime? value) if (value.HasValue) { slot.Type = MarshalerType.DateTime; - slot.DoubleValue = new DateTimeOffset(value.Value).ToUnixTimeMilliseconds(); + slot.DoubleValue = new DateTimeOffset(value.Value.Ticks, TimeSpan.Zero).ToUnixTimeMilliseconds(); } else { diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System.Runtime.InteropServices.JavaScript.Tests.csproj b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System.Runtime.InteropServices.JavaScript.Tests.csproj index 7da762fed4180d..15e2c682f6ecab 100644 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System.Runtime.InteropServices.JavaScript.Tests.csproj +++ b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System.Runtime.InteropServices.JavaScript.Tests.csproj @@ -7,6 +7,7 @@ true true $(WasmXHarnessArgs) --engine-arg=--expose-gc --web-server-use-cop + $(WasmXHarnessMonoArgs) --setenv=TZ=Europe/Berlin true true $(DefineConstants);FEATURE_WASM_MANAGED_THREADS