I want to show date and time in Clojurescript, but anything I tried did not work. Can anyone help with an example? I tried to use JavaScript datatime in different syntax ways, but none of them worked. Thank you.
Update
I tired these but they did not work:
(. (js/Date))
(js/Date.)
(now (js/Date))
(js/Date.new)
(js/Date.new.)
(.new (js/Date)
I just wont to show the current date and time on the screen. Inside a [:h3] tag in the .cljs file.
(.toLocaleString (js/Date.))
;; => "22/11/2022, 17:17:22"
and in [:h3]
:
[:h3 (.toLocaleString (js/Date.))]
If you want other formatting you can mix and match the available methods on a Date instance using interop.