Cldr.Calendar.previous

You're seeing just the function previous, go back to Cldr.Calendar module for more information.
Link to this function

previous(date_or_date_range, date_part, options \\ [])

View Source

Returns the previous date or date range for a date period (year, quarter, month, week or day).

Arguments

  • date_or_date_range is any Date.t or Date.Range.t

  • period is :year, :quarter, :month, :week or :day

  • options is a Keyword list of options that is passed to plus/4 or minus/4

Returns

When a Date.t is passed, a Date.t is returned. When a Date.Range.t is passed a Date.Range.t is returned.

Examples

iex> Cldr.Calendar.previous ~D[2019-01-01], :day
~D[2018-12-31]

iex> Cldr.Calendar.previous ~D[2019-01-01], :quarter
~D[2018-10-01]

iex> Cldr.Calendar.previous ~D[2019-01-01], :month
~D[2018-12-01]

iex> Cldr.Calendar.previous ~D[2019-01-01], :year
~D[2018-01-01]