From: Olli Helttula Date: Fri, 7 Feb 2014 11:07:45 +0000 (+0200) Subject: Change copying of Date values to avoid wrapping of date (#13269) X-Git-Tag: 7.1.12~21 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3b327f6131166d3b503a55b7e91b853d179a3595;p=vaadin-framework.git 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 --- 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();