@@ -852,7 +852,7 @@ defmodule Date do
852852 end
853853
854854 @ doc """
855- Calculates the day of the week of a given `date`.
855+ Calculates the ordinal day of the week of a given `date`.
856856
857857 Returns the day of the week as an integer. For the ISO 8601
858858 calendar (the default), it is an integer from 1 to 7, where
@@ -861,10 +861,19 @@ defmodule Date do
861861 An optional `starting_on` value may be supplied, which
862862 configures the weekday the week starts on. The default value
863863 for it is `:default`, which translates to `:monday` for the
864- built-in ISO calendar. Any other weekday may be given to.
864+ built-in ISO 8601 calendar. Any other weekday may be used for
865+ `starting_on`, in such cases, that weekday will be considered the first
866+ day of the week, and therefore it will be assigned the ordinal number 1.
867+
868+ The other calendars, the value returned is an ordinal day of week.
869+ For example, `1` may mean "first day of the week" and `7` is
870+ defined to mean "seventh day of the week". Custom calendars may
871+ also accept their own variations of the `starting_on` parameter
872+ with their own meaning.
865873
866874 ## Examples
867875
876+ # 2016-10-31 is a Monday and by default Monday is the first day of the week
868877 iex> Date.day_of_week(~D[2016-10-31])
869878 1
870879 iex> Date.day_of_week(~D[2016-11-01])
@@ -874,6 +883,7 @@ defmodule Date do
874883 iex> Date.day_of_week(~D[-0015-10-30])
875884 3
876885
886+ # 2016-10-31 is a Monday but, as we start the week on Sunday, now it returns 2
877887 iex> Date.day_of_week(~D[2016-10-31], :sunday)
878888 2
879889 iex> Date.day_of_week(~D[2016-11-01], :sunday)
0 commit comments