Date.compare
You're seeing just the function
compare
, go back to Date module for more information.
Specs
compare(Calendar.date(), Calendar.date()) :: :lt | :eq | :gt
Compares two date structs.
Returns :gt
if first date is later than the second
and :lt
for vice versa. If the two dates are equal
:eq
is returned.
Examples
iex> Date.compare(~D[2016-04-16], ~D[2016-04-28])
:lt
This function can also be used to compare across more complex calendar types by considering only the date fields:
iex> Date.compare(~D[2016-04-16], ~N[2016-04-28 01:23:45])
:lt
iex> Date.compare(~D[2016-04-16], ~N[2016-04-16 01:23:45])
:eq
iex> Date.compare(~N[2016-04-16 12:34:56], ~N[2016-04-16 01:23:45])
:eq