From 44c5b933b50af83206c392c0ca21de9b81becb27 Mon Sep 17 00:00:00 2001 From: rhiannon morris Date: Fri, 19 Jul 2024 19:19:31 +0200 Subject: [PATCH] fix padding in yyyy/mm/dd dates --- make-pages/Date.hs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/make-pages/Date.hs b/make-pages/Date.hs index 7a5bb33..c2486b6 100644 --- a/make-pages/Date.hs +++ b/make-pages/Date.hs @@ -78,9 +78,12 @@ formatRSS = fromString . format . toTime where formatSlash :: Date -> Builder formatSlash (Date {year, month, day}) = case dayNum day of - Nothing -> [b|$year/$month|] - Just d -> [b|$year/$month/$d$q|] - where q = if exact day then "" else [b|?|] + Nothing -> [b|$year/$mm|] + Just d -> [b|$year/$mm/$dd$q|] where dd = pad2 d + where + mm = pad2 month + q = if exact day then "" else [b|?|] + pad2 x = let str = show x in if length str == 1 then '0':str else str nth :: Int -> Builder