graphql

Eamonn Sullivan 2020-01-09T12:35:40.001300Z

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.

Eamonn Sullivan 2020-01-09T12:51:12.002600Z

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 .

2020-01-09T12:58:36.002700Z

what format are your date times in?

Eamonn Sullivan 2020-01-09T12:58:47.002900Z

strings

2020-01-09T12:59:16.003100Z

(i’ll continue in the other thread)