From 3721ccaa97a6c2fe24e52d0efc91c06bcc971aac Mon Sep 17 00:00:00 2001 From: Dennis Kigen Date: Thu, 27 Apr 2023 11:59:20 +0300 Subject: [PATCH] More safety checks --- src/validators/ohri-form-validator.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/validators/ohri-form-validator.ts b/src/validators/ohri-form-validator.ts index de9d5304..9b413bc2 100644 --- a/src/validators/ohri-form-validator.ts +++ b/src/validators/ohri-form-validator.ts @@ -32,7 +32,7 @@ export const OHRIFieldValidator: FieldValidator = { }; export function numberInputRangeValidator(min: number, max: number, inputValue: number) { - if (min && inputValue < Number(min)) { + if (!Number.isNaN(min) && inputValue < min) { return [ { resultType: 'error', @@ -42,7 +42,7 @@ export function numberInputRangeValidator(min: number, max: number, inputValue: ]; } - if (max && inputValue > Number(max)) { + if (!Number.isNaN(max) && inputValue > max) { return [ { resultType: 'error',