Hi, what’s up everyone?
I’d be very grateful if someone wiser the me could open up this following error message a bit:
DateTime.to_iso8601/2 expects format to be :extended or :basic, got: :extended
I read it over and over again but my logic just fails me. It wants :extended but gets :extended. Pretty deep and almost poetic but not very helpful…
I’d really fancy some datetimes on my Absinthe type, like this:
import_types Absinthe.Type.Custom
object :user do
field :id, :id
field :updated_at, :datetime
field :inserted_at, :datetime
end
I also tried to use my own scalar type instead of the import_types, like this:
scalar :datetime do
parse fn input ->
case DateTime.from_iso8601(input.value) do
{:ok, datetime} -> {:ok, datetime}
_ -> :error
end
end
serialize fn datetime ->
DateTime.to_iso8601(datetime)
end
end
…but this resulted the very same error message.
So what am I doing wrong or is there a better way to do this?