mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-29 07:53:23 +00:00
fix: Ajout du controle sur le format des dates
This commit is contained in:
@ -109,6 +109,7 @@ export default function StudentInfoForm({
|
||||
};
|
||||
|
||||
const getLocalError = (field) => {
|
||||
const dateRegex = /^\d{4}-\d{2}-\d{2}$/;
|
||||
if (
|
||||
// Student Form
|
||||
(field === 'last_name' &&
|
||||
@ -120,7 +121,9 @@ export default function StudentInfoForm({
|
||||
(field === 'nationality' &&
|
||||
(!formData.nationality || formData.nationality.trim() === '')) ||
|
||||
(field === 'birth_date' &&
|
||||
(!formData.birth_date || formData.birth_date.trim() === '')) ||
|
||||
(!formData.birth_date ||
|
||||
formData.birth_date.trim() === '' ||
|
||||
!dateRegex.test(formData.birth_date))) ||
|
||||
(field === 'birth_place' &&
|
||||
(!formData.birth_place || formData.birth_place.trim() === '')) ||
|
||||
(field === 'birth_postal_code' &&
|
||||
|
||||
Reference in New Issue
Block a user