Swiss.Date (swiss v3.12.0) View Source
Some extra functions for working with Dates that aren't in the native lib or on Timex.
Link to this section Summary
Functions
Returns the biggest (latest) of the given list of dates.
Returns the biggest (latest) of two dates.
Returns the smallest (earliest) of the given list of datetimes.
Returns the smallest (earliest) of two dates.
Link to this section Functions
Specs
Returns the biggest (latest) of the given list of dates.
Examples
iex> Swiss.Date.max([~D[2022-01-22], ~D[2022-02-01], ~D[2021-12-30]])
~D[2022-02-01]
iex> Swiss.Date.max([~D[2021-12-30], nil])
~D[2021-12-30]
iex> Swiss.Date.max([nil, nil, ~D[2022-02-01]])
~D[2022-02-01]
Specs
Returns the biggest (latest) of two dates.
Examples
iex> Swiss.Date.max(~D[2022-01-22], ~D[2022-02-01])
~D[2022-02-01]
Specs
Returns the smallest (earliest) of the given list of datetimes.
Examples
iex> Swiss.Date.min([~D[2022-01-22], ~D[2022-02-01], ~D[2021-12-30]])
~D[2021-12-30]
iex> Swiss.Date.min([~D[2022-02-01], nil])
~D[2022-02-01]
iex> Swiss.Date.min([nil, nil, ~D[2022-02-01]])
~D[2022-02-01]
Specs
Returns the smallest (earliest) of two dates.
Examples
iex> Swiss.Date.min(~D[2022-01-22], ~D[2022-02-01])
~D[2022-01-22]