Days between dates: Difference between revisions

Content added Content deleted
Line 988: Line 988:


showDateDiff :: String -> String -> String
showDateDiff :: String -> String -> String
showDateDiff xs ys =
showDateDiff s1 s2 =
maybe
maybe
( unlines
( unlines
["Unparseable as date string pair:", xs, ys]
["Unparseable as date string pair:", s1, s2]
)
)
( \n ->
( \n ->
concat
concat
["There are ", show n, " days between ", xs, " and ", ys, "."]
["There are ", show n, " days between ", s1, " and ", s2, "."]
)
)
$ daysBetween xs ys</lang>
$ daysBetween s1 s2</lang>
{{Out}}
{{Out}}
<pre>There are 272 days between 2019-01-01 and 2019-09-30.
<pre>There are 272 days between 2019-01-01 and 2019-09-30.