Cldr.Calendar.week_of_month
You're seeing just the function
week_of_month
, go back to Cldr.Calendar module for more information.
Specs
week_of_month(Date.t()) :: {Calendar.month(), week()}
Returns the {month, week_number}
for a date
.
The nature of a week depends on the calendar configuration and therefore some results may be surprising. For example the date of December 31st 2018 is actually in month one of the ISO Week calendar of 2019.
Arguments
date
is anyDate.t()
Returns
a tuple of the form
{month, week}
or{:error, :not_defined}
if the calendar does not support the concept of weeks.
Examples
iex> Cldr.Calendar.week_of_month(~D[2019-01-01])
{1, 1}
iex> Cldr.Calendar.week_of_month(~D[2018-12-31])
{1, 1}
iex> Cldr.Calendar.week_of_month(~D[2019-01-01 Cldr.Calendar.BasicWeek])
{1, 1}
iex> Cldr.Calendar.week_of_month(~D[2018-12-31 Cldr.Calendar.BasicWeek])
{12, 5}
iex> Cldr.Calendar.week_of_month(~D[2018-12-31 Cldr.Calendar.Julian])
{:error, :not_defined}