Full second rounding for timeFieldProfile (thanks SealedSun)

This commit is contained in:
Michael Snoyman 2010-12-26 11:49:35 +02:00
parent 79c9e1753a
commit aa1090d055

View File

@ -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