Añadir restriccion para la edad de un empleado

This commit is contained in:
Melina Gutierrez 2024-11-25 15:33:34 -04:00
parent cab12f7ae5
commit c9f2e0900a

View File

@ -184,7 +184,7 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
LocalDate selectedDate = event.getValue(); LocalDate selectedDate = event.getValue();
if (selectedDate != null && ChronoUnit.YEARS.between(selectedDate, LocalDate.now()) < 18) { if (selectedDate != null && ChronoUnit.YEARS.between(selectedDate, LocalDate.now()) < 18) {
birthday.setInvalid(true); birthday.setInvalid(true);
birthday.setErrorMessage("El empleado debe ser mayor de 18 años"); birthday.setErrorMessage("El empleado debe ser mayor o tener 18 años");
} else { } else {
birthday.setInvalid(false); birthday.setInvalid(false);
} }