fixed rounding bug in currencyField
This commit is contained in:
parent
a60213eace
commit
0b2cd56712
1 changed files with 1 additions and 1 deletions
|
@ -71,7 +71,7 @@ currencyField :: (RenderMessage (HandlerSite m) FormMessage, Show a, Monad m, In
|
||||||
currencyField = Field
|
currencyField = Field
|
||||||
{ fieldParse = parseHelper $ \rawVals ->
|
{ fieldParse = parseHelper $ \rawVals ->
|
||||||
case R.double (prependZero rawVals) of
|
case R.double (prependZero rawVals) of
|
||||||
Right (a, "") -> Right $ floor $ 100 * a
|
Right (a, "") -> Right $ floor $ (100 * a) + 0.5
|
||||||
_ -> Left $ MsgInvalidNumber rawVals
|
_ -> Left $ MsgInvalidNumber rawVals
|
||||||
, fieldView = \theId name attr val req -> toWidget [hamlet|$newline never
|
, 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}>
|
<input id=#{theId} name=#{name} *{attr} type="number" step=0.01 min=0 :req:required="required" value=#{showVal val}>
|
||||||
|
|
Loading…
Reference in a new issue