Merge branch 'fix-compare-begin-end-dates' into 'master'

fix compare begin and end dates

See merge request framasoft/mobilizon!420
This commit is contained in:
Thomas Citharel 2020-04-04 13:02:16 +02:00
commit f0d9f236ca
1 changed files with 1 additions and 1 deletions

View File

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