Hi all,
I am new to Rust and couldn't figure this one out, probably it is something simple for others with more experience. Hopefully it will also help other new users as well.
Requirement:
I want to get today's date in WASM in en-US date format. I am able to achieve it with chorono but wanted to try the same with js-sys since it uses browser JS libraries.
What I did so far:
I used js-sys "new_0" to get current date and then used "to_utc_string" method:
I tried to use js-sys "Intl::DateTimeFormat" struct and "format" method, which supposed to convert "js-sys date" to given locale specific format but I couldn't make it work:
Issue:
As per the MDN documentation link of "format" method of "DateTimeFormat", it should take date as parameter but in Rust implementation it doesn't take any parameter so I am not sure how to pass that value.
"format" method returns "Function" struct so probably something need to be done with it but I have no clue and no example is provided.
Thanks