see comment

This commit is contained in:
Rajpreet0 2025-12-16 15:58:01 +01:00
parent 7aec673c99
commit 226d4b8c26

View file

@ -30,17 +30,22 @@ export const userRegisterSchema = z
"Passwort muss mindestens 8 Zeichen haben, Großbuchstaben, Kleinbuchstaben, Nummer und ein spezielles Zeichen beinhalten"
),
passwordConfirm: z.string(),
birthday: z.string().refine(
(date) => {
const selectedDate = new Date(date);
const today = new Date();
today.setHours(0, 0, 0, 0);
return selectedDate <= today;
},
{
message: "Geburtsdatum darf nicht in der Zukunft liegen",
}
),
birthday: z.iso
.date({
message: "Ungültiges Datumsformat",
})
.refine(
(date) => {
const selectedDate = new Date(date);
selectedDate.setHours(0, 0, 0, 0);
const today = new Date();
today.setHours(0, 0, 0, 0);
return selectedDate <= today;
},
{
message: "Geburtsdatum darf nicht in der Zukunft liegen",
}
),
plz: z.string().min(1, "PLZ erforderlich"),
place: z.string().min(1, "Wohnort erforderlich"),
street: z.string().min(1, "Straße erforderlich"),