]> source.dussan.org Git - vaadin-framework.git/commitdiff
Change copying of Date values to avoid wrapping of date (#13269)
authorOlli Helttula <olli@vaadin.com>
Fri, 7 Feb 2014 11:07:45 +0000 (13:07 +0200)
committerVaadin Code Review <review@vaadin.com>
Thu, 13 Feb 2014 08:48:39 +0000 (08:48 +0000)
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

index 96678fd1330c26362176131ea7a2b8971e6ebb0e..e584a21563204e34b027d688aba66ade54095e64 100644 (file)
@@ -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();