Zod Form string to number
Unanswered
Netherland Dwarf posted this in #help-forum
Netherland DwarfOP
Hello, i'm new to React and NextJs and i'm trying to build a form using Zod, the issue is I don't manage to submit my input as an number here the code
When I submit it, I get the error message "Expected number, received string" Thanks a lot 🙂
When I submit it, I get the error message "Expected number, received string" Thanks a lot 🙂
3 Replies
Netherland DwarfOP
Netherland DwarfOP
Yup. I found the solution :
const formSchema = z.object({
expiry: z.coerce.number().min(1, {
message: "The expiry should be atleast 1.",
}),
})