Next.js Discord

Discord Forum

zod is not validating number() for amount in tutorial

Unanswered
American Shorthair posted this in #help-forum
Open in Discord
American ShorthairOP
When following the [tutorial](https://nextjs.org/learn/dashboard-app/mutating-data) I have completed the section on updating an invoice. And I can so long as I only change the dollar amount, if I change the cents, I get an error similar to the following:

Please enter a valid value. The two nearest valid values are 776.77 and 777.77


Where the value I entered was 777.76 and the original value was 777.77.

Zod, indeed, has this line:

   amount: z.coerce.number(),


Am I doing something wrong? [Example repo](https://github.com/joshuacox/animated-garbanzo/tree/updateValidate)

0 Replies