-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
-
I use zod and react-hook-form when I validate emails but adding a dash at the end doesn't trigger the error
-
I tried using emailRegex in zod doc but no error trigger
-
I'm wondering if the problem is there or not?
-
I tried with yup and got the trigger error
import { useCallback, VFC } from "react";
import { SubmitHandler, useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import * as z from "zod";
const auth = z.object({
email: z
.string()
.email("正しいメールアドレスの形式で入力してください"),
password: z.string()
});
const user = z.object({
firstName: z
.string()
.min(1, { message: "1文字以上入力してください" })
.max(10, { message: "10文字以下で入力してください" }),
lastName: z
.string()
.min(1, { message: "1文字以上入力してください" })
.max(10, { message: "10文字以下で入力してください" }),
phoneNumber: z.string().regex(/^0\d{9,10}$/, {
message: "正しい電話番号の形式で入力してください"
}),
role: z.enum(["admin", "user"])
});
Metadata
Metadata
Assignees
Labels
No labels


