WA-238 Allowing set a Daily Limit of 0 when creating a Safe

This commit is contained in:
apanizo 2018-05-22 09:21:56 +02:00
parent 29e92ca622
commit bd2e6b70a5
2 changed files with 3 additions and 3 deletions

View File

@ -17,7 +17,7 @@ export const greaterThan = (min: number) => (value: string) => {
}
export const minValue = (min: number) => (value: string) => {
if (Number.isNaN(Number(value)) || Number.parseInt(value, 10) >= Number(min)) {
if (Number.isNaN(Number(value)) || Number.parseFloat(value) >= Number(min)) {
return undefined
}

View File

@ -2,7 +2,7 @@
import * as React from 'react'
import Field from '~/components/forms/Field'
import TextField from '~/components/forms/TextField'
import { composeValidators, mustBeNumber, required, greaterThan } from '~/components/forms/validator'
import { composeValidators, mustBeNumber, required, minValue } from '~/components/forms/validator'
import Block from '~/components/layout/Block'
import { FIELD_DAILY_LIMIT } from '~/routes/open/components/fields'
@ -12,7 +12,7 @@ const DailyLimit = () => (
name={FIELD_DAILY_LIMIT}
component={TextField}
type="text"
validate={composeValidators(required, mustBeNumber, greaterThan(0))}
validate={composeValidators(required, mustBeNumber, minValue(0))}
placeholder="Daily Limit*"
text="Daily Limit"
/>