Date.end_of_week

You're seeing just the function end_of_week, go back to Date module for more information.
Link to this function

end_of_week(date, starting_on \\ :default)

View Source (since 1.11.0)

Specs

end_of_week(Calendar.date(), starting_on :: :default | atom()) :: t()

Calculates a date that is the last day of the week for the given date.

If the day is already the last day of the week, it returns the day itself. For the built-in ISO calendar, the week ends on Sunday. A weekday rather than :default can be given as starting_on.

Examples

iex> Date.end_of_week(~D[2020-07-11])
~D[2020-07-12]
iex> Date.end_of_week(~D[2020-07-05])
~D[2020-07-05]
iex> Date.end_of_week(~D[2020-07-06], :sunday)
~D[2020-07-11]
iex> Date.end_of_week(~D[2020-07-06], :sunday)
~D[2020-07-11]
iex> Date.end_of_week(~D[2020-07-06], :saturday)
~D[2020-07-10]
iex> Date.end_of_week(~N[2020-07-11 01:23:45])
~D[2020-07-12]