@@ -17,32 +17,32 @@ defmodule Calendar.ISO do
1717 @ type day :: 1 .. 31
1818
1919 @ doc """
20- Returns the last day of the month for the given year.
20+ Returns how many days there are in the given year-month .
2121
2222 ## Examples
2323
24- iex> Calendar.ISO.last_day_of_month (1900, 1)
24+ iex> Calendar.ISO.days_in_month (1900, 1)
2525 31
26- iex> Calendar.ISO.last_day_of_month (1900, 2)
26+ iex> Calendar.ISO.days_in_month (1900, 2)
2727 28
28- iex> Calendar.ISO.last_day_of_month (2000, 2)
28+ iex> Calendar.ISO.days_in_month (2000, 2)
2929 29
30- iex> Calendar.ISO.last_day_of_month (2001, 2)
30+ iex> Calendar.ISO.days_in_month (2001, 2)
3131 28
32- iex> Calendar.ISO.last_day_of_month (2004, 2)
32+ iex> Calendar.ISO.days_in_month (2004, 2)
3333 29
34- iex> Calendar.ISO.last_day_of_month (2004, 4)
34+ iex> Calendar.ISO.days_in_month (2004, 4)
3535 30
3636
3737 """
38- @ spec last_day_of_month ( year , month ) :: 28 .. 31
39- def last_day_of_month ( year , month )
38+ @ spec days_in_month ( year , month ) :: 28 .. 31
39+ def days_in_month ( year , month )
4040
41- def last_day_of_month ( year , 2 ) do
41+ def days_in_month ( year , 2 ) do
4242 if leap_year? ( year ) , do: 29 , else: 28
4343 end
44- def last_day_of_month ( _ , month ) when month in [ 4 , 6 , 9 , 11 ] , do: 30
45- def last_day_of_month ( _ , month ) when month in 1 .. 12 , do: 31
44+ def days_in_month ( _ , month ) when month in [ 4 , 6 , 9 , 11 ] , do: 30
45+ def days_in_month ( _ , month ) when month in 1 .. 12 , do: 31
4646
4747 @ doc """
4848 Returns if the given year is a leap year.
0 commit comments