Fix isNumber validator
authorMichal Klobukowski <michal.klobukowski@contractors.roche.com>
Mon, 1 Oct 2018 08:06:41 +0000 (10:06 +0200)
committerMichal Klobukowski <michal.klobukowski@contractors.roche.com>
Mon, 1 Oct 2018 08:06:41 +0000 (10:06 +0200)
Feature #13863

Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski@contractors.roche.com>

src/validators/is-number.tsx

index 9b548b948384a500df50134db9c9da888b48ba64..152c647fe47ee87fc49f9329b5b6dd6102b48967 100644 (file)
@@ -6,5 +6,5 @@ import { isNumber as isNum } from 'lodash';
 const ERROR_MESSAGE = 'This field must be a number';
 
 export const isNumber = (value: any) => {
-    return isNum(value) ? undefined : ERROR_MESSAGE;
+    return !isNaN(value) && isNum(value) ? undefined : ERROR_MESSAGE;
 };