From 33ca3133d746510dd160621a702b8efcf20096ff Mon Sep 17 00:00:00 2001 From: Melina Gutierrez Date: Thu, 28 Nov 2024 07:27:45 -0400 Subject: [PATCH] Corregir que la fecha de las horas trabjadas sean solo una semana atras y ya no un mes --- .../primefactorsolutions/views/HoursWorkedView.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/primefactorsolutions/views/HoursWorkedView.java b/src/main/java/com/primefactorsolutions/views/HoursWorkedView.java index b191f99..80f4a13 100644 --- a/src/main/java/com/primefactorsolutions/views/HoursWorkedView.java +++ b/src/main/java/com/primefactorsolutions/views/HoursWorkedView.java @@ -168,16 +168,11 @@ public class HoursWorkedView extends BeanValidationForm 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 implements }); } + private void saveHoursWorked() { if (isFormValid()) { HoursWorked hoursWorked = getEntity();