Timex Scalar Types in Absinthe

Zachery Moneypenny
Adorable
Published in
1 min readSep 7, 2017

Update: I’ve now submitted a PR to the Absinthe documentation website repo. It will hopefully be reflected in the official Absinthe docs soon.

In bootstrapping a GraphQL endpoint for my Elixir services I came across an issue with how the official Absinthe documentation describes defining scalar terms, specifically time.

Due to a change in the Timex API for v3, the sample code is no longer correct.

The incorrect code is:

If you use the code from the documentation you’ll get the following compile error:

warning: function Timex.DateFormat.parse/2 is undefined (module Timex.DateFormat is not available)
lib/foo_web/schema/types.ex:73
warning: function Timex.DateFormat.format!/2 is undefined (module Timex.DateFormat is not available)
lib/foo_web/schema/types.ex:74

The corrected code if you using ~> 3.0.0 of Timex is:

Zachery Moneypenny is a Principal Developer at adorable.io. Rubyist for a long time, with experience in Golang and Javascript as well but moving towards Elixir and loving it.

--

--

Zachery Moneypenny
Adorable

engineering manager at cars.com | opinions on tech interviewing | woodworking | song-and-dance man