summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@plataformatec.com.br>2016-09-15 10:28:38 +0200
committerJosé Valim <jose.valim@plataformatec.com.br>2016-09-15 10:28:56 +0200
commitb6360b0aae3b09e1a360a1cae64b870723b49d94 (patch)
treea362b73142c9d7fb329a7f5aeb27d08b5bb10774
parentf4fef0a257fd3980c125c6eb9f9b1f348f8d5bf4 (diff)
downloadelixir-b6360b0aae3b09e1a360a1cae64b870723b49d94.tar.gz
Fix last_day_of_month callback
-rw-r--r--lib/elixir/lib/calendar/iso.ex20
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/elixir/lib/calendar/iso.ex b/lib/elixir/lib/calendar/iso.ex
index 20b4bddde..6f28e06df 100644
--- a/lib/elixir/lib/calendar/iso.ex
+++ b/lib/elixir/lib/calendar/iso.ex
@@ -43,10 +43,12 @@ defmodule Calendar.ISO do
## Examples
- iex> Calendar.ISO.last_day_of_month(2000, 1)
+ iex> Calendar.ISO.last_day_of_month(1900, 1)
31
- iex> Calendar.ISO.last_day_of_month(2000, 2)
+ iex> Calendar.ISO.last_day_of_month(1900, 2)
28
+ iex> Calendar.ISO.last_day_of_month(2000, 2)
+ 29
iex> Calendar.ISO.last_day_of_month(2001, 2)
28
iex> Calendar.ISO.last_day_of_month(2004, 2)
@@ -55,16 +57,16 @@ defmodule Calendar.ISO do
30
"""
- def last_day_of_the_month(year, month)
+ def last_day_of_month(year, month)
- def last_day_of_the_month(year, 2) do
+ def last_day_of_month(year, 2) do
if leap_year?(year), do: 29, else: 28
end
- def last_day_of_the_month(_, 4), do: 30
- def last_day_of_the_month(_, 6), do: 30
- def last_day_of_the_month(_, 9), do: 30
- def last_day_of_the_month(_,11), do: 30
- def last_day_of_the_month(_, month) when month in 1..12, do: 31
+ def last_day_of_month(_, 4), do: 30
+ def last_day_of_month(_, 6), do: 30
+ def last_day_of_month(_, 9), do: 30
+ def last_day_of_month(_,11), do: 30
+ def last_day_of_month(_, month) when month in 1..12, do: 31
@doc """
Returns if the given year is a leap year.