Skip to content

Commit

Permalink
Date Validation ok (sin hora ni tener en cuenta no bisiesto)
Browse files Browse the repository at this point in the history
  • Loading branch information
laura-riera committed Jul 5, 2022
1 parent 7159b13 commit 88b8f47
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
21 changes: 21 additions & 0 deletions src/SchoolManagementSystem.Presentation/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/SchoolManagementSystem.Presentation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"react": "^18.2.0",
"react-bootstrap": "^2.4.0",
"react-dom": "^18.2.0",
"react-faq-component": "^1.3.4",
"react-router-dom": "^6.3.0",
"react-scripts": "^5.0.1",
"school-calendar-react": "^1.0.1",
Expand Down
18 changes: 16 additions & 2 deletions src/SchoolManagementSystem.Presentation/src/pages/Students.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const Students = () => {
message: "Introduzca el nombre."
},
{
pattern: /^\S{2,}(\s\S{2,})?(\s\S{2,})?(\s\S{2,})?$/,
pattern: /^[a-zA-Z]{2,}(\s[a-zA-Z]{2,})?(\s[a-zA-Z]{2,})?(\s[a-zA-Z]{2,})?$/,
message: 'El nombre solo puede contener letras (dos como mínimo). En caso de ser compuesto, deben estar separados por un único espacio.'
},
]
Expand All @@ -70,7 +70,7 @@ const Students = () => {
message: "Introduzca los apellidos."
},
{
pattern: /^\S{2,}(\s\S{2,})?(\s\S{2,})?(\s\S{2,})?$/,
pattern: /^[a-zA-Z]{2,}(\s[a-zA-Z]{2,})?(\s[a-zA-Z]{2,})?(\s[a-zA-Z]{2,})?$/,
message: 'Los apellidos solo pueden contener letras (dos como mínimo) y estar separados por un único espacio.'
},
]
Expand Down Expand Up @@ -114,6 +114,10 @@ const Students = () => {
{
whitespace: true,
message: "Introduzca la dirección."
},
{
pattern: /^[a-zA-Z0-9,#/&\-.\s]{1,100}$/,
message: "La dirección debe tener máximo 100 caracteres."
}
]
},
Expand All @@ -133,6 +137,11 @@ const Students = () => {
{
whitespace: true,
message: "Introduzca el grado de escolaridad."
},
{
pattern: /^\bPrimaria|Secundaria|EscuelaOficios|TecnicoMedio|Preuniversitario|Universidad|Posgrado\b$/,
message: "El nivel escolar debe ser de uno de los siguientes tipos: Primaria, Secundaria, EscuelaOficios, " +
"TecnicoMedio, Preuniversitario, Universidad, Posgrado."
}
],
},
Expand All @@ -152,6 +161,11 @@ const Students = () => {
{
whitespace: true,
message: "Introduzca la fecha de inicio en la sede."
},
{
//pattern: /^(0[1-9]|1[0-2])[-/.](0[1-9]|[12][0-9]|3[01])[-/.]\d{4}$/,
pattern: /^\b1[-/.](0[1-9]|[12][0-9]|3[01])[-/.](19[0-9][0-9]|20[01][0-9]|2022)|2[-/.](0[1-9]|[12][0-9]|2[08])[-/.](19[0-9][0-9]|20[01][0-9]|2022)|3[-/.](0[1-9]|[12][0-9]|3[01])[-/.](19[0-9][0-9]|20[01][0-9]|2022)|4[-/.](0[1-9]|[12][0-9]|3[00])[-/.](19[0-9][0-9]|20[01][0-9]|2022)|5[-/.](0[1-9]|[12][0-9]|3[01])[-/.](19[0-9][0-9]|20[01][0-9]|2022)|6[-/.](0[1-9]|[12][0-9]|3[00])[-/.](19[0-9][0-9]|20[01][0-9]|2022)|7[-/.](0[1-9]|[12][0-9]|3[01])[-/.](19[0-9][0-9]|20[01][0-9]|2022)|8[-/.](0[1-9]|[12][0-9]|3[01])[-/.](19[0-9][0-9]|20[01][0-9]|2022)|9[-/.](0[1-9]|[12][0-9]|3[00])[-/.](19[0-9][0-9]|20[01][0-9]|2022)|10[-/.](0[1-9]|[12][0-9]|3[01])[-/.](19[0-9][0-9]|20[01][0-9]|2022)|11[-/.](0[1-9]|[12][0-9]|3[00])[-/.](19[0-9][0-9]|20[01][0-9]|2022)|12[-/.](0[1-9]|[12][0-9]|3[01])[-/.](19[0-9][0-9]|20[01][0-9]|2022)\b$/,
message: "El formato de la fecha debe ser M/d/yyyy. Ej: 4/22/2021."
}
]
},
Expand Down

0 comments on commit 88b8f47

Please sign in to comment.