diff --git a/lib/guardsafe.ex b/lib/guardsafe.ex index eb299b2..5d8eda7 100644 --- a/lib/guardsafe.ex +++ b/lib/guardsafe.ex @@ -1,5 +1,5 @@ defmodule Guardsafe do - @vsn "0.5.0" + @vsn "0.5.1" @doc false def version, do: @vsn @@ -139,7 +139,8 @@ defmodule Guardsafe do Returns true if the term is considered to be a time tuple. The time is not checked for validity other than the hours being in - the 0..23 range and the minutes and seconds being in the 0..59 range. + the 0..23 range, the minutes being in the 0..59 range, and seconds + being in the 0..60 range. The latter due to the existance of leap seconds. ## Examples @@ -155,7 +156,7 @@ defmodule Guardsafe do and is_integer(elem(unquote(term), 1)) and (elem(unquote(term), 1) |> within?(0, 59)) and is_integer(elem(unquote(term), 2)) - and (elem(unquote(term), 2) |> within?(0, 59)) + and (elem(unquote(term), 2) |> within?(0, 60)) end end diff --git a/mix.exs b/mix.exs index bedf25d..f32e647 100644 --- a/mix.exs +++ b/mix.exs @@ -4,7 +4,7 @@ defmodule Guardsafe.Mixfile do def project do [ app: :guardsafe, - version: "0.5.0", + version: "0.5.1", name: "Guardsafe", source_url: "https://github.com/DevL/guardsafe", homepage_url: "https://hex.pm/packages/guardsafe", diff --git a/test/guardsafe_test.exs b/test/guardsafe_test.exs index f72f6b3..44f0ddf 100644 --- a/test/guardsafe_test.exs +++ b/test/guardsafe_test.exs @@ -138,8 +138,9 @@ defmodule GuardsafeTest do test "time?" do assert When.using_time?({0, 0, 0}) assert When.using_time?({23, 59, 59}) + assert When.using_time?({23, 59, 60}) refute When.using_time?({23, 60, 59}) - refute When.using_time?({23, 59, 60}) + refute When.using_time?({23, 59, 61}) refute When.using_time?({24, 0, 0}) refute When.using_time?({-1, 0, 0}) refute When.using_time?({12, 15}) @@ -149,7 +150,7 @@ defmodule GuardsafeTest do test "datetime?" do assert When.using_datetime?({{2015, 3, 14}, {21, 49, 52}}) refute When.using_datetime?({{2015, 13, 14}, {21, 49, 52}}) - refute When.using_datetime?({{2015, 3, 14}, {23, 59, 60}}) + refute When.using_datetime?({{2015, 3, 14}, {23, 59, 61}}) refute When.using_datetime?({{2015, 3, 14}, {23, 59}}) refute When.using_datetime?({2015, 3, 14}) end