79563547

Date: 2025-04-09 05:52:00
Score: 1
Natty:
Report link

for me the easiest way was to just use a normal input field and then use

z.string().regex(/^[1-9]\d*$/)

with this you can safely convert the string value into a number later (in your onSubmit method for example). if you need float values you would need to change the regex. Not sure if this is the right way to do it but this it works really well.

Reasons:
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: Jonathan