diff --git a/mix.exs b/mix.exs index c3c8427..9a530e6 100644 --- a/mix.exs +++ b/mix.exs @@ -19,7 +19,7 @@ defmodule Chess.Mixfile do def application do [mod: {Chess, []}, applications: [:phoenix, :phoenix_pubsub, :phoenix_html, :cowboy, :logger, :gettext, - :phoenix_ecto, :postgrex]] + :phoenix_ecto, :postgrex, :timex_ecto]] end # Specifies which paths to compile per environment. @@ -38,7 +38,7 @@ defmodule Chess.Mixfile do {:phoenix_live_reload, "~> 1.0", only: :dev}, {:gettext, "~> 0.11"}, {:cowboy, "~> 1.0"}, - {:timex, "~> 3.1"}] + {:timex_ecto, "~> 3.0"}] end # Aliases are shortcuts or tasks specific to the current project. diff --git a/mix.lock b/mix.lock index 92b66f4..37ebaad 100644 --- a/mix.lock +++ b/mix.lock @@ -25,4 +25,5 @@ "ranch": {:hex, :ranch, "1.2.1", "a6fb992c10f2187b46ffd17ce398ddf8a54f691b81768f9ef5f461ea7e28c762", [:make], []}, "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.1", "28a4d65b7f59893bc2c7de786dec1e1555bd742d336043fe644ae956c3497fbe", [:make, :rebar], []}, "timex": {:hex, :timex, "3.1.5", "413d6d8d6f0162a5d47080cb8ca520d790184ac43e097c95191c7563bf25b428", [], [{:combine, "~> 0.7", [hex: :combine, optional: false]}, {:gettext, "~> 0.10", [hex: :gettext, optional: false]}, {:tzdata, "~> 0.1.8 or ~> 0.5", [hex: :tzdata, optional: false]}]}, + "timex_ecto": {:hex, :timex_ecto, "3.0.5", "3ec6c25e10d2c0020958e5df64d2b5e690e441faa2c2259da8bc6bd3d7f39256", [:mix], [{:ecto, "~> 2.0", [hex: :ecto, optional: false]}, {:timex, "~> 3.0", [hex: :timex, optional: false]}]}, "tzdata": {:hex, :tzdata, "0.5.9", "575be217b039057a47e133b72838cbe104fb5329b19906ea4e66857001c37edb", [:mix], [{:hackney, "~> 1.0", [hex: :hackney, optional: false]}]}} diff --git a/web/models/game.ex b/web/models/game.ex index fb3c4a8..4d169da 100644 --- a/web/models/game.ex +++ b/web/models/game.ex @@ -4,7 +4,7 @@ defmodule Chess.Game do schema "games" do field :board, :map - timestamps() + timestamps end @doc """ diff --git a/web/templates/game/index.html.eex b/web/templates/game/index.html.eex index 297d880..1ec8690 100644 --- a/web/templates/game/index.html.eex +++ b/web/templates/game/index.html.eex @@ -5,7 +5,7 @@ <%= for game <- @games do %> - <%= link "Started on #{Timex.format!(game.inserted_at, "%b %e at %I:%M%P", :strftime)}", to: game_path(@conn, :show, game), class: "btn btn-default btn-xs" %> + <%= link "Started on #{Timex.format!(game.inserted_at, "%b %e at %I:%M %P", :strftime)}", to: game_path(@conn, :show, game), class: "btn btn-default btn-xs" %> <%= link "Delete", to: game_path(@conn, :delete, game), method: :delete, data: [confirm: "Are you sure?"], class: "btn btn-danger btn-xs" %> diff --git a/web/web.ex b/web/web.ex index 386b20c..2dad93f 100644 --- a/web/web.ex +++ b/web/web.ex @@ -20,6 +20,8 @@ defmodule Chess.Web do quote do use Ecto.Schema + use Timex.Ecto.Timestamps + import Ecto import Ecto.Changeset import Ecto.Query