Skip to content

Commit

Permalink
Merge branch 'Validation' into cri
Browse files Browse the repository at this point in the history
  • Loading branch information
laura-riera committed Jul 5, 2022
2 parents b308bcf + 2a85db5 commit 70f6fca
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/SchoolManagementSystem.Presentation/src/pages/Students.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ const Students = () => {
},
{
//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$/,
pattern: /^\b1[-/.](0[1-9]|[12][0-9]|3[01])[-/.](19[0-9][0-9]|20[0-2][0-2])|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 All @@ -181,6 +181,10 @@ const Students = () => {
{
whitespace: true,
message: "Introduzca el número de teléfono."
},
{
pattern: /^\d$/,
message: 'El teléfono solo puede contener números.'
}
]
},
Expand All @@ -193,6 +197,10 @@ const Students = () => {
compare: (a, b) => a.founds - b.founds
},
rules: [
{
pattern: /^\d$/,
message: 'Los fondos solo pueden contener números.'
}
]
},
{
Expand All @@ -204,6 +212,10 @@ const Students = () => {
compare: (a, b) => a.tuitorName.localeCompare(b.tuitorName)
},
rules: [
{
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 @@ -215,6 +227,10 @@ const Students = () => {
compare: (a, b) => a.tuitorPhoneNumber - b.tuitorPhoneNumber
},
rules: [
{
pattern: /^\d$/,
message: 'El teléfono solo puede contener números.'
}
]
}
];
Expand Down

0 comments on commit 70f6fca

Please sign in to comment.