From aa1090d055857f3c579e8ed74b8df93929eddc54 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Sun, 26 Dec 2010 11:49:35 +0200 Subject: [PATCH] Full second rounding for timeFieldProfile (thanks SealedSun) --- Yesod/Form/Profiles.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Yesod/Form/Profiles.hs b/Yesod/Form/Profiles.hs index 7cbd8a79..2592c6f5 100644 --- a/Yesod/Form/Profiles.hs +++ b/Yesod/Form/Profiles.hs @@ -88,12 +88,17 @@ dayFieldProfile = FieldProfile timeFieldProfile :: FieldProfile sub y TimeOfDay timeFieldProfile = FieldProfile { fpParse = parseTime - , fpRender = show + , fpRender = show . roundFullSeconds , fpWidget = \theId name val isReq -> addHamlet [HAMLET| %input#$theId$!name=$name$!:isReq:required!value=$val$ |] } + where + roundFullSeconds tod = + TimeOfDay (todHour tod) (todMin tod) fullSec + where + fullSec = fromInteger $ floor $ todSec tod htmlFieldProfile :: FieldProfile sub y Html htmlFieldProfile = FieldProfile