This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-01-12
Channels
- # announcements (2)
- # babashka (26)
- # beginners (48)
- # calva (32)
- # cider (23)
- # clj-kondo (61)
- # cljfx (3)
- # clojure (93)
- # clojure-australia (2)
- # clojure-europe (23)
- # clojure-losangeles (1)
- # clojure-nl (5)
- # clojure-uk (4)
- # clojurescript (46)
- # cloverage (9)
- # code-reviews (1)
- # copenhagen-clojurians (1)
- # cursive (39)
- # data-science (6)
- # datahike (8)
- # deps-new (8)
- # depstar (2)
- # etaoin (1)
- # fulcro (2)
- # funcool (2)
- # graalvm (5)
- # jackdaw (3)
- # java (17)
- # jobs-discuss (43)
- # kaocha (2)
- # leiningen (25)
- # malli (8)
- # minecraft (1)
- # missionary (8)
- # observability (6)
- # off-topic (37)
- # other-languages (12)
- # practicalli (1)
- # reagent (4)
- # releases (78)
- # remote-jobs (1)
- # sci (9)
- # shadow-cljs (13)
- # spacemacs (6)
- # sql (1)
- # tools-deps (30)
- # xtdb (3)
Any recommendation on dealing with time? I've got multiple fields that hold LocalDateTime and it's not clear to me how I should express that.
you could c&p code from this https://github.com/metosin/malli/pull/545, or wait for the PR or just do something like:
(def LocalDateTime
(m/-simple-schema
{:type 'LocalDateTime
:pred #(instance? LocalDateTime %)
:type-properties {:error/message "invalid date-time"
:decode/string #(LocalDate/parse %)
:json-schema {:type "string"
:format "date-time"}}))
(m/validate LocalDateTime (LocalDateTime/now)) ; => true
(didn’t run that, might not work, but like that anyways.When walking a schema, what does the nil
that appears as the second entry in all children represent?
(def temperaturmätning
(malli/schema
[:map
[:odlingsplats [string? {:min 1}]]
[:tidpunkt string?]]))
(malli/walk
temperaturmätning
(fn [schema path children _]
(println "Path: " path)
(println "Type: " (malli/type schema))
(print "Schema: ")
(clojure.pprint/pprint schema)
(clojure.pprint/pprint children)
(case (malli/type schema)
string? [:input {:type "text"} (-> path last name)]
:map [:div.input-group children])
))
;; [:div.input-group
;; [[:odlingsplats nil [:input {:type "text"} "odlingsplats"]]
;; [:tidpunkt nil [:input {:type "text"} "tidpunkt"]]]]