79090051

Date: 2024-10-15 13:01:58
Score: 1
Natty:
Report link

Change the input type to text and use this schema for that field validation

But the downfall is the user can provide negative number.

const schema = z.object({
  numberField: z.string().refine((value) => /^\d*$/.test(value), {
    message: 'Must be a valid positive number',
  }),
});
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Shrey Vadaliya