Fix DateTime comparison

!420 used Date.compare/2 instead of DateTime.compare/2

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2020-04-14 17:50:17 +02:00
parent 19a065ca13
commit fa19270232
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773

View file

@ -167,7 +167,7 @@ defmodule Mobilizon.Events.Event do
case fetch_field(changeset, :begins_on) do case fetch_field(changeset, :begins_on) do
{_, begins_on} -> {_, begins_on} ->
validate_change(changeset, :ends_on, fn :ends_on, ends_on -> validate_change(changeset, :ends_on, fn :ends_on, ends_on ->
if Date.compare(begins_on, ends_on) == :gt, if DateTime.compare(begins_on, ends_on) == :gt,
do: [ends_on: "ends_on cannot be set before begins_on"], do: [ends_on: "ends_on cannot be set before begins_on"],
else: [] else: []
end) end)