Skip to content

Commit

Permalink
fix empty string not throwing error (#557)
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoalzate authored May 23, 2024
1 parent a7c6a47 commit 660af0e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/berlin/src/pages/Register.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -867,10 +867,14 @@ function NumberInput(props: {
return true;
}

if (value.trim() === '') {
return 'Value is required';
}

const v = z.coerce
.number()
.int('Value has to be an integer')
.min(0, 'Value must be positive')
.nonnegative('Value must be positive')
.safeParse(value);

if (v.success) {
Expand Down

0 comments on commit 660af0e

Please sign in to comment.