Creating global javascript objects (like Date) in Clojurescript
1,502 views
Skip to first unread message
Conrad
unread,
Aug 12, 2011, 5:19:07 PM8/12/11
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Clojure
Sorry if this has an obvious answer, but there is still only limited
documentation on clojurescript native interop on the net right now,
and none of the code I've seen of runs into this use case...
How do I create a javascript Date object in Clojurescript? I've tried:
(Date.)
(window/Date.)
(.now Date)
I've run out of ideas for what the correct incantation is- Can someone
give me a pointer? Thanks!
-Conrad Barski
Michael Wood
unread,
Aug 12, 2011, 6:15:43 PM8/12/11
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to clo...@googlegroups.com
After some trial and error, I found this:
ClojureScript:cljs.user> (new js/Date) #<Sat Aug 13 2011 00:14:54 GMT+0200 (SAST)> ClojureScript:cljs.user> (js/Date.) #<Sat Aug 13 2011 00:15:01 GMT+0200 (SAST)>