]> source.dussan.org Git - vaadin-framework.git/commitdiff
#6718 Fixed an off-by-one bug; use displayedMonth consistently
authorJohannes Dahlström <johannes.dahlstrom@vaadin.com>
Fri, 27 Jan 2012 15:20:55 +0000 (15:20 +0000)
committerJohannes Dahlström <johannes.dahlstrom@vaadin.com>
Fri, 27 Jan 2012 15:20:55 +0000 (15:20 +0000)
svn changeset:22802/svn branch:6.8

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

index a2f03d6176d58944265a9eeccd9be98a8615d8b3..eb1a742db9bb78cf9da4d244fde52ff5c1d81201 100644 (file)
@@ -481,11 +481,11 @@ public class VCalendarPanel extends FocusableFlexTable implements
                 tmp.getDate());
 
         final int startWeekDay = getDateTimeService().getStartWeekDay(
-                focusedDate);
-        final Date curr = (Date) focusedDate.clone();
+                displayedMonth);
+        final Date curr = (Date) displayedMonth.clone();
         // Start from the first day of the week that at least partially belongs
         // to the current month
-        curr.setDate(-startWeekDay);
+        curr.setDate(1 - startWeekDay);
 
         // No month has more than 6 weeks so 6 is a safe maximum for rows.
         for (int weekOfMonth = 1; weekOfMonth < 7; weekOfMonth++) {
@@ -508,7 +508,7 @@ public class VCalendarPanel extends FocusableFlexTable implements
                         day.addStyleDependentName(CN_FOCUSED);
                     }
                 }
-                if (curr.getMonth() != focusedDate.getMonth()) {
+                if (curr.getMonth() != displayedMonth.getMonth()) {
                     day.addStyleDependentName(CN_OFFMONTH);
                 }