]> source.dussan.org Git - vaadin-framework.git/commitdiff
Actual fix for #5594
authorJonatan Kronqvist <jonatan.kronqvist@itmill.com>
Tue, 14 Sep 2010 12:24:47 +0000 (12:24 +0000)
committerJonatan Kronqvist <jonatan.kronqvist@itmill.com>
Tue, 14 Sep 2010 12:24:47 +0000 (12:24 +0000)
svn changeset:14908/svn branch:6.4

src/com/vaadin/terminal/gwt/client/ui/VCalendarPanel.java

index df50ca0391acba32c0c5a5dab6e5ebe6f596fe4c..c97f360d530a61a5cf81c7093f71250945e1c08f 100644 (file)
@@ -259,16 +259,27 @@ public class VCalendarPanel extends FocusableFlexTable implements
     private void selectFocused() {\r
         if (focusedDate != null) {\r
             int changedFields = 0;\r
+            /*\r
+             * #5594 set Date (day) to 1 in order to prevent any kind of\r
+             * wrapping of months when later setting the month. (e.g. 31 ->\r
+             * month with 30 days -> wraps to the 1st of the following month,\r
+             * e.g. 31st of May -> 31st of April = 1st of May)\r
+             */\r
+            value.setDate(1);\r
             if (value.getYear() != focusedDate.getYear()) {\r
+                value.setYear(focusedDate.getYear());\r
                 changedFields += VDateField.RESOLUTION_YEAR;\r
             }\r
             if (value.getMonth() != focusedDate.getMonth()) {\r
+                value.setMonth(focusedDate.getMonth());\r
                 changedFields += VDateField.RESOLUTION_MONTH;\r
             }\r
             if (value.getDate() != focusedDate.getDate()) {\r
                 changedFields += VDateField.RESOLUTION_DAY;\r
             }\r
-            value.setTime(focusedDate.getTime());\r
+            // We always need to set the date, even if it hasn't changed, since\r
+            // it was forced to 1 above.\r
+            value.setDate(focusedDate.getDate());\r
 \r
             selectDate(focusedDate.getDate());\r
         } else {\r