Skip to content

Commit 0cf7a4a

Browse files
author
yaroslav8765
committed
fix: don't validate optional empty fields as invalid
1 parent 5277727 commit 0cf7a4a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

adminforth/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,10 +315,10 @@ class AdminForth implements IAdminForth {
315315
return error;
316316
}
317317
} else {
318-
if (column.minValue !== undefined && record[column.name] < column.minValue) {
318+
if (column.minValue !== undefined && record[column.name] && record[column.name] < column.minValue) {
319319
return `Value in "${column.name}" must be greater than ${column.minValue}`;
320320
}
321-
if (column.maxValue !== undefined && record[column.name] > column.maxValue) {
321+
if (column.maxValue !== undefined && record[column.name] && record[column.name] > column.maxValue) {
322322
return `Value in "${column.name}" must be less than ${column.maxValue}`;
323323
}
324324
}

0 commit comments

Comments
 (0)