This is my Clojurescript function,
(defn message-list [messages]
(println messages) ;; stmt#1
[:ul.messages
(for [{:keys [timestamp message name]} @messages]
^{:key timestamp}
[:li
[:time (.toLocaleString timestamp)] ;; stmt#2
[:p message]
[:p " - " name]])])
stmt#1 is printing,
#<Atom: [{:id 1, :name Adeel Ansari, :message Hello, from the other side.,
:timestamp #object[Transit$TaggedValue [TaggedValue: LocalDateTime, 2020-01-13T18:19:50.552]]}]>
and stmt#2 is printing,
[TaggedValue: LocalDateTime, 2020-01-13T18:19:50.552]
Now, I would like to print it as, say, 13/01/2020 18:19; how should I go about it? I've no idea how to decode tagged-values.
You can obtain the value from the
TaggedValueusing.-rep, and then, you can parse thatStringusing some library.For example you can parse the date, using cljc.java-time, like this:
Or you can use Tick; then your code would look something like,