:utc_datetime in Absinthe

ecto
phoenix
absinthe
#1

Hi all,

Ecto schema:

  schema "tasks" do
    field :description, :string
    field :end_datetime, :utc_datetime
    field :name, :string
    field :priority, :string, default: "NORMAL"
    field :start_datetime, :utc_datetime
    field :state, :string, default: "INPROGRESS"
    belongs_to :tasklist, Tasklist, on_replace: :delete

    timestamps(type: :utc_datetime)
  end

Absinthe schema:

defmodule ErlnoteWeb.Schema.TasksTypes do
  use Absinthe.Schema.Notation

  object :task do
    field :id, :id
    field :name, :string
    field :start_datetime, ???
    field :end_datetime, ???
  end

end

How can I use :utc_datetime (ecto) in Absinthe?

#2

import_types Absinthe.Type.Custom

defmodule ErlnoteWeb.Schema.TasksTypes do
  use Absinthe.Schema.Notation

  object :task do
    field :id, :id
    field :name, :string
    field :description, :string
    field :state, :string
    field :priority, :string
    field :start_datetime, :datetime
    field :end_datetime, :datetime
  end

end