Browse Source

Re(set) calendar time after calculating rollAmount (#9479)

by calling calendar.setTime(today);
after rollAmount has been initialized and given a value, we can reset the calendar's internal time back to the correct date. As it is currently implemented; calling calendar.getTime() will result in a wrong date, it returns the first of the month with the correct time.
The function addInitialEvents() is called AFTER the calendar's time has been subtracted from (by calculating the rollAmount), as such this results in an incorrect internal time and the 'Day' button does not switch to the correct day. Instead it shows the first of the month here too.
tags/8.1.2
Grim 6 years ago
parent
commit
0c993377de

+ 1
- 0
uitest/src/main/java/com/vaadin/tests/themes/valo/CalendarTest.java View File

@@ -580,6 +580,7 @@ public class CalendarTest extends GridLayout implements View {
int rollAmount = calendar.get(GregorianCalendar.DAY_OF_MONTH) - 1;
calendar.add(GregorianCalendar.DAY_OF_MONTH, -rollAmount);
currentMonthsFirstDate = calendar.getTime();
calendar.setTime(today);

updateCaptionLabel();


Loading…
Cancel
Save