Skip to content

Commit

Permalink
More safety checks
Browse files Browse the repository at this point in the history
  • Loading branch information
denniskigen committed Apr 27, 2023
1 parent ec1f010 commit 3721cca
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/validators/ohri-form-validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
Expand Down

0 comments on commit 3721cca

Please sign in to comment.