Cldr.Calendar.Kday.first_kday

You're seeing just the function first_kday, go back to Cldr.Calendar.Kday module for more information.

Specs

Return the date of the first day_of_week on or after the specified date.

Arguments

  • date is %Date{}, a %DateTime{}, %NaiveDateTime{} or ISO days

  • k is an integer day of the week.

Returns

  • A %Date{”} in the calendar of the date provided as an argument

Examples

# US election day
iex> Cldr.Calendar.Kday.first_kday(~D[2017-11-02], 2)
~D[2017-11-07]

# US Daylight savings end
iex> Cldr.Calendar.Kday.first_kday(~D[2017-11-01], 7)
~D[2017-11-05]