From 147c235f7b87c4d5b3390d3ccb382ec421da1a5e Mon Sep 17 00:00:00 2001 From: Mikhail Mikheev Date: Tue, 8 Oct 2019 16:13:58 +0400 Subject: [PATCH] use parseFloat in maxValue validator so it works for numbers between 0 and 1 and respects decimals --- src/components/forms/validator.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/forms/validator.js b/src/components/forms/validator.js index 26b33e35..462b21d5 100644 --- a/src/components/forms/validator.js +++ b/src/components/forms/validator.js @@ -50,8 +50,8 @@ export const minValue = (min: number) => (value: string) => { return `Should be at least ${min}` } -export const maxValue = (max: number) => (value: string) => { - if (Number.isNaN(Number(value)) || Number.parseInt(value, 10) <= Number(max)) { +export const maxValue = (max: number | string) => (value: string) => { + if (Number.isNaN(Number(value)) || parseFloat(value, 10) <= parseFloat(max, 10)) { return undefined }