diff options
Diffstat (limited to 'src/Date.hs')
-rw-r--r-- | src/Date.hs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/Date.hs b/src/Date.hs index 8ab9fd2..63830d3 100644 --- a/src/Date.hs +++ b/src/Date.hs @@ -2,6 +2,8 @@ module Date ( Date(..) , getCurrentDate , sameDayAndMonth + , isBeforeOrEqualDayAndMonth + , isAfterOrEqualDayAndMonth , yearsGap ) where @@ -29,5 +31,21 @@ sameDayAndMonth d1 d2 = && month d1 == month d2 ) +isBeforeOrEqualDayAndMonth :: Date -> Date -> Bool +isBeforeOrEqualDayAndMonth d1 d2 = + ( month d1 < month d2 + || ( month d1 == month d2 + && day d1 <= day d2 + ) + ) + +isAfterOrEqualDayAndMonth :: Date -> Date -> Bool +isAfterOrEqualDayAndMonth d1 d2 = + ( month d1 > month d2 + || ( month d1 == month d2 + && day d1 >= day d2 + ) + ) + yearsGap :: Date -> Date -> Int yearsGap d1 d2 = abs (year d2 - year d1) |