From 3b327f6131166d3b503a55b7e91b853d179a3595 Mon Sep 17 00:00:00 2001 From: Olli Helttula Date: Fri, 7 Feb 2014 13:07:45 +0200 Subject: [PATCH] Change copying of Date values to avoid wrapping of date (#13269) The error occurs only when current day is in the end of the month and the textfield has no value when choosing months in the CalendarPanel. This can not be sensibly tested by automated tests as it would require setting the server time to a date that would trigger the problem (for example 30.1). The error does not occur if the value is set before setting the resolution (by the user or programmatically). Change-Id: I6b3e5b699a773bd84b0f756d0c53698a09854a81 --- client/src/com/vaadin/client/ui/VCalendarPanel.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/client/src/com/vaadin/client/ui/VCalendarPanel.java b/client/src/com/vaadin/client/ui/VCalendarPanel.java index 96678fd133..e584a21563 100644 --- a/client/src/com/vaadin/client/ui/VCalendarPanel.java +++ b/client/src/com/vaadin/client/ui/VCalendarPanel.java @@ -892,9 +892,8 @@ public class VCalendarPanel extends FocusableFlexTable implements if (!isDateInsideRange(requestedNextMonthDate, Resolution.DAY)) { requestedNextMonthDate = adjustDateToFitInsideRange(requestedNextMonthDate); } - focusedDate.setYear(requestedNextMonthDate.getYear()); - focusedDate.setMonth(requestedNextMonthDate.getMonth()); - focusedDate.setDate(requestedNextMonthDate.getDate()); + + focusedDate.setTime(requestedNextMonthDate.getTime()); displayedMonth.setMonth(displayedMonth.getMonth() + 1); renderCalendar(); @@ -949,9 +948,7 @@ public class VCalendarPanel extends FocusableFlexTable implements if (!isDateInsideRange(requestedPreviousMonthDate, Resolution.DAY)) { requestedPreviousMonthDate = adjustDateToFitInsideRange(requestedPreviousMonthDate); } - focusedDate.setYear(requestedPreviousMonthDate.getYear()); - focusedDate.setMonth(requestedPreviousMonthDate.getMonth()); - focusedDate.setDate(requestedPreviousMonthDate.getDate()); + focusedDate.setTime(requestedPreviousMonthDate.getTime()); displayedMonth.setMonth(displayedMonth.getMonth() - 1); renderCalendar(); -- 2.39.5