fixed rounding bug in currencyField

This commit is contained in:
nek0 2015-10-12 16:34:03 +02:00
parent a60213eace
commit 0b2cd56712
1 changed files with 1 additions and 1 deletions

View File

@ -71,7 +71,7 @@ currencyField :: (RenderMessage (HandlerSite m) FormMessage, Show a, Monad m, In
currencyField = Field
{ fieldParse = parseHelper $ \rawVals ->
case R.double (prependZero rawVals) of
Right (a, "") -> Right $ floor $ 100 * a
Right (a, "") -> Right $ floor $ (100 * a) + 0.5
_ -> Left $ MsgInvalidNumber rawVals
, fieldView = \theId name attr val req -> toWidget [hamlet|$newline never
<input id=#{theId} name=#{name} *{attr} type="number" step=0.01 min=0 :req:required="required" value=#{showVal val}>