Corregir que la fecha de las horas trabjadas sean solo una semana atras y ya no un mes

This commit is contained in:
Melina Gutierrez 2024-11-28 07:27:45 -04:00 committed by alex
parent e3e9910696
commit 3acc1426bf

View File

@ -168,16 +168,11 @@ public class HoursWorkedView extends BeanValidationForm<HoursWorked> implements
private void initializeDateField() {
LocalDate today = LocalDate.now();
YearMonth currentMonth = YearMonth.of(today.getYear(), today.getMonth());
LocalDate startOfMonth = currentMonth.atDay(1);
LocalDate lastWeekMonday = today.minusWeeks(1).with(java.time.DayOfWeek.MONDAY);
LocalDate maxSelectableDate = today;
dateField.setMin(startOfMonth);
dateField.setMin(lastWeekMonday);
dateField.setMax(maxSelectableDate);
dateField.setValue(today);
dateField.addValueChangeListener(event -> {
LocalDate selectedDate = event.getValue();
if (selectedDate != null) {
@ -191,6 +186,7 @@ public class HoursWorkedView extends BeanValidationForm<HoursWorked> implements
});
}
private void saveHoursWorked() {
if (isFormValid()) {
HoursWorked hoursWorked = getEntity();