fix: Ajout du controle sur le format des dates

This commit is contained in:
N3WT DE COMPET
2025-05-03 16:52:02 +02:00
parent 889a3a48c5
commit e538ac3d56
3 changed files with 17 additions and 10 deletions

View File

@ -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' &&