Is there a way to get system time/date inside of a yew app?

Viewed 543

Normally in a rust app, I'd get system time with std::time::SystemTime::now(), but that doesn't seem to work in a yew app. Instead the component I'm trying to read the system time from just silently (from the server logs) fails and in the web console I get panicked at 'time not implemented on this platform'.

Which makes sense, the client app can't just grab system time from the OS willy-nilly for security reasons. But does yew provide a way to get this from the browser?

1 Answers

https://crates.io/crates/instant looks like it might do the job. But while it defines fn like now() I don't think that it will make crates that rely on std::time to work :-(

Related