WA-238 Allowing set a Daily Limit of 0 when creating a Safe
This commit is contained in:
parent
29e92ca622
commit
bd2e6b70a5
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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"
|
||||
/>
|
||||
|
|
Loading…
Reference in New Issue