Reputation: 5670
If I try to print DateTime.Now.TimeOfDay
in Uno, Wasm, and UWP will print two different times. Wasm in UTC and UWP in current culture. How can I make sure in both cases I get Local time?
Upvotes: 0
Views: 218
Reputation: 5282
Update 2020/07/15: This is now fixed as part of the Uno.Wasm.Bootstrap package v1.3.
This is a known issue in mono for WebAssembly, which will be fixed once this Uno.Wasm.Bootrapper PR passes.
Upvotes: 2
Reputation: 51
I ran into this issue as well. To resolve use javascript. When wasm is detected use Uno.Foundation.WebAssemblyRuntime.InvokeJS.
var getTime = Uno.Foundation.WebAssemblyRuntime.InvokeJS("javaTime()");
In a javascript file in your wasm WasmScripts folder
function javaTime()
{
var date = new Date();
return date.toLocaleTimeString();
}
Upvotes: 1