From 660af0eb82da8d342944c3be9bb5e5f75c6f1a2b Mon Sep 17 00:00:00 2001 From: Diego Alzate Date: Thu, 23 May 2024 14:31:42 +0100 Subject: [PATCH] fix empty string not throwing error (#557) --- packages/berlin/src/pages/Register.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/berlin/src/pages/Register.tsx b/packages/berlin/src/pages/Register.tsx index d66ce054..8bf6c3ea 100644 --- a/packages/berlin/src/pages/Register.tsx +++ b/packages/berlin/src/pages/Register.tsx @@ -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) {