Corregir que la fecha de las horas trabjadas sean solo una semana atras y ya no un mes
This commit is contained in:
parent
e3e9910696
commit
3acc1426bf
@ -168,16 +168,11 @@ public class HoursWorkedView extends BeanValidationForm<HoursWorked> implements
|
|||||||
|
|
||||||
private void initializeDateField() {
|
private void initializeDateField() {
|
||||||
LocalDate today = LocalDate.now();
|
LocalDate today = LocalDate.now();
|
||||||
YearMonth currentMonth = YearMonth.of(today.getYear(), today.getMonth());
|
LocalDate lastWeekMonday = today.minusWeeks(1).with(java.time.DayOfWeek.MONDAY);
|
||||||
|
|
||||||
LocalDate startOfMonth = currentMonth.atDay(1);
|
|
||||||
|
|
||||||
LocalDate maxSelectableDate = today;
|
LocalDate maxSelectableDate = today;
|
||||||
|
dateField.setMin(lastWeekMonday);
|
||||||
dateField.setMin(startOfMonth);
|
|
||||||
dateField.setMax(maxSelectableDate);
|
dateField.setMax(maxSelectableDate);
|
||||||
dateField.setValue(today);
|
dateField.setValue(today);
|
||||||
|
|
||||||
dateField.addValueChangeListener(event -> {
|
dateField.addValueChangeListener(event -> {
|
||||||
LocalDate selectedDate = event.getValue();
|
LocalDate selectedDate = event.getValue();
|
||||||
if (selectedDate != null) {
|
if (selectedDate != null) {
|
||||||
@ -191,6 +186,7 @@ public class HoursWorkedView extends BeanValidationForm<HoursWorked> implements
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void saveHoursWorked() {
|
private void saveHoursWorked() {
|
||||||
if (isFormValid()) {
|
if (isFormValid()) {
|
||||||
HoursWorked hoursWorked = getEntity();
|
HoursWorked hoursWorked = getEntity();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user