fix padding in yyyy/mm/dd dates

This commit is contained in:
rhiannon morris 2024-07-19 19:19:31 +02:00
parent 28520eb443
commit 44c5b933b5

View file

@ -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|<span class=q>?</span>|]
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|<span class=q>?</span>|]
pad2 x = let str = show x in if length str == 1 then '0':str else str
nth :: Int -> Builder