summaryrefslogtreecommitdiff
path: root/src/Util.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Util.hs')
-rw-r--r--src/Util.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Util.hs b/src/Util.hs
index 4c09705..64c0bfc 100644
--- a/src/Util.hs
+++ b/src/Util.hs
@@ -3,7 +3,7 @@ module Util (module Util, toList) where
import Data.Foldable (toList)
import Data.Maybe (fromMaybe)
-import Data.Time (Day, toGregorian)
+import Data.Time
import Data.Word (Word8)
@@ -52,3 +52,9 @@ dayToYMD :: Day -> YMD
dayToYMD day =
let (y, m, d) = toGregorian day
in YMD (fromIntegral y) (fromIntegral m) (fromIntegral d)
+
+ymdToGregorian :: YMD -> (Year, MonthOfYear, DayOfMonth)
+ymdToGregorian (YMD y m d) = (fromIntegral y, fromIntegral m, fromIntegral d)
+
+ymdFromGregorian :: (Year, MonthOfYear, DayOfMonth) -> YMD
+ymdFromGregorian (y, m, d) = YMD (fromIntegral y) (fromIntegral m) (fromIntegral d)