Skip to content

Commit a7b63b8

Browse files
committed
Use 12 instead of 0, PM starts at 12, not 13
1 parent 158e590 commit a7b63b8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Data/Formatter/DateTime.purs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,10 @@ formatF cb dt@(DT.DateTime d t) = case _ of
186186
Hours24 a →
187187
show (fromEnum $ T.hour t) <> cb a
188188
Hours12 a →
189-
show ((fromEnum $ T.hour t) `mod` 12) <> cb a
189+
let fix12 h = if h == 0 then 12 else h
190+
in show (fix12 $ (fromEnum $ T.hour t) `mod` 12) <> cb a
190191
Meridiem a →
191-
(if (fromEnum $ T.hour t) > 12 then "PM" else "AM") <> cb a
192+
(if (fromEnum $ T.hour t) >= 12 then "PM" else "AM") <> cb a
192193
Minutes a →
193194
show (fromEnum $ T.minute t) <> cb a
194195
Seconds a →

0 commit comments

Comments
 (0)