summaryrefslogtreecommitdiff
path: root/src/Util.hs
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2026-04-08 10:04:31 +0200
committerTom Smeding <tom@tomsmeding.com>2026-04-08 10:06:47 +0200
commit7105c50f858684b894b1c010a405dd7531dccb6c (patch)
tree08673f8973c5078c4cc95eaff5e748af990e975b /src/Util.hs
parent59b485a3c860c81546f3a2b5389b14e5001e053d (diff)
Timestamp links on calendar-day page
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)