This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-01-09
Channels
- # announcements (28)
- # babashka (8)
- # bangalore-clj (1)
- # beginners (123)
- # boot (1)
- # bristol-clojurians (1)
- # calva (3)
- # cider (30)
- # clj-kondo (42)
- # cljs-dev (5)
- # clojure (260)
- # clojure-dev (11)
- # clojure-europe (7)
- # clojure-india (1)
- # clojure-italy (2)
- # clojure-losangeles (5)
- # clojure-nl (5)
- # clojure-portugal (15)
- # clojure-uk (51)
- # clojurescript (69)
- # cursive (6)
- # data-science (21)
- # datascript (17)
- # datomic (1)
- # emacs (29)
- # figwheel-main (11)
- # fulcro (89)
- # graphql (5)
- # hoplon (2)
- # hugsql (6)
- # jobs (11)
- # juxt (1)
- # leiningen (7)
- # luminus (1)
- # malli (3)
- # off-topic (64)
- # pathom (32)
- # project-updates (1)
- # re-frame (9)
- # reagent (10)
- # reitit (21)
- # ring (5)
- # ring-swagger (1)
- # shadow-cljs (8)
- # spacemacs (6)
- # xtdb (4)
Hi all, I'm a newbie and getting a baffling error when trying to add a custom scalar DateTime type to my schema. I'm trying to use clojure.java-time and I'm getting what I suspect is an error from the underyling Java that I don't understand: No single method: start of interface: java_time.interval.AnyInterval found for function: start of protocol: AnyInterval
My schema has:
:scalars
{:DateTime
{:parse :parse-datetime
:serialize :serialize-datetime}}
My parsers/serializers (assuming `[java-time :as jt]):
(defn parse-datetime
[s]
(when (string? s)
(try
(jt/offset-date-time s)
(catch Throwable _
nil))))
(defn serialize-datetime
[d]
(when (jt/offset-date-time? d)
(try
(str (jt/offset-date-time d))
(catch Throwable _
nil))))
And I'm compiling my schema with:
(`attach-scalar-transformers {:parse-datetime parse-datetime`
:serialize-datetime serialize-datetime})
Does this look familiar to anyone? The examples for lacinia don't include anything with a custom scalar, that I could find, and the only example with dates uses epoch milliseconds.
The schema seems to attach the transformers OK (at least in the repl), so I suspect this might be a clojure.java-time question. I'll ask in #clojure .
what format are your date times in?
strings
(i’ll continue in the other thread)