CalendarExt (calendar_ext v0.1.6)

Link to this section Summary

Functions

Calculates the week number of week days between from_date and to_date.

Returns the earliest date.

Returns the latest date

Converts dateable to %Date{}. It will return nil for nil values.

Returns the morning of NaiveDateTime.utc_now().

Link to this section Types

Link to this type

calendar_ext()

Specs

calendar_ext() :: Date.t() | DateTime.t() | NaiveDateTime.t()

Specs

dateable() :: Date.t() | DateTime.t() | NaiveDateTime.t()
Link to this type

nillable_date()

Specs

nillable_date() :: Date.t() | nil

Link to this section Functions

Link to this function

diff_weekdays(from_date, to_date)

Specs

diff_weekdays(dateable(), dateable()) :: integer()

Calculates the week number of week days between from_date and to_date.

Examples

iex> CalendarExt.diff_weekdays(~D[2020-10-10], ~D[2020-10-20]) 6

It will return 0 if the second date is in the past

iex> CalendarExt.diff_weekdays(~D[2020-10-10], ~D[2020-08-20]) 0

Link to this function

max(left, right)

Specs

Returns the earliest date.

Link to this function

min(left, right)

Specs

Returns the latest date

Link to this function

outside?(date, start_date, end_date)

Specs

Specs

to_date(dateable()) :: nillable_date()

Converts dateable to %Date{}. It will return nil for nil values.

Link to this function

to_naive_with_invalid_time(date_string, default_offset \\ "Z")

Specs

utc_morning() :: NaiveDateTime.t()

Returns the morning of NaiveDateTime.utc_now().