This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-12-08
Channels
- # adventofcode (49)
- # babashka (21)
- # babashka-sci-dev (12)
- # beginners (250)
- # calva (23)
- # cider (6)
- # clj-kondo (11)
- # cljsrn (8)
- # clojure (129)
- # clojure-europe (50)
- # clojure-france (8)
- # clojure-italy (6)
- # clojure-nl (14)
- # clojure-romania (7)
- # clojure-spec (21)
- # clojure-uk (3)
- # clojurescript (17)
- # conjure (1)
- # core-async (40)
- # core-logic (24)
- # core-typed (7)
- # datavis (2)
- # datomic (2)
- # emacs (29)
- # fulcro (10)
- # graalvm (6)
- # graphql (24)
- # gratitude (6)
- # jobs (1)
- # lsp (9)
- # malli (6)
- # missionary (1)
- # nextjournal (46)
- # off-topic (2)
- # other-languages (3)
- # pathom (5)
- # portal (2)
- # re-frame (37)
- # remote-jobs (1)
- # shadow-cljs (15)
- # spacemacs (9)
- # testing (6)
- # tools-deps (13)
- # vim (32)
- # xtdb (16)
I have only used reagent and was looking at rum. In reagent we use react components like so: [:> Foobar …]. Is it possible to do that in rum. If so, how?
any clues for using inst? with
(js/Date.parse ("2020-02-02"))
or similar? Just something to easily determine if the value is a dateand its really the value of the atom backing the date input, so even more opportunities for bugs / etc.
Right. Well, you can't use inst?
for that because it simply checks for the class.
I would parse the string, get date js/Date
object from it, and then format it back into a string (e.g. by calling .toISOString
and then splitting on T
). After that, I would compare the two strings - if they are the same, the entered date is valid. But you need to check whether timezones can affect it.
Date.parse returns string date to just seconds from epoch, but passing the date string to js/Date. "yyyy-mm-dd" creates the correct JS date object and can do what you mentioned with .toISOString
There be demons here (at least there were a few years ago). Be sure to test your solution on different browsers. Chrome and Firefox had rather divergent handling of those different types on <input type="___">
. We ended up making our own custom input widgets for dates/times.
Internationalization was also a challenge here (and a requirement in our app); different locales have different date formats. Especially the US vs Europe with month-day vs day-month.