Closed bendardenne closed 6 years ago
I can consistently reproduce this in the current development version, when selecting Jan 1, holding shift and then selecting Feb 28. For some reason not all range selections trigger the issue.
Changing CalendarPicker#constructDisplayedCalendar to :
private void constructDisplayedCalendar()
{
// init here, so deriveDisplayedCalendar in the skin will modify it accordingly
Calendar calendar = Calendar.getInstance(getLocale());
calendar.set(Calendar.MILLISECOND, 0);
setDisplayedCalendar( calendar );
}
Seems to prevent the problem. Not entirely sure why it does not consistently happen for every date range though.
Thanks for reporting and examining! I'll take a look ASAP.
Created a test and fixed it. Thank you.
Hi,
I have a calendar picker set up with mode=RANGE.
I have noticed that sometimes, selecting a range with the shift key held down will cause an infinite loop.
After some debugging, I noticed something weird: in CalendarPickerControlSkin#toggle, the following loop:
never exits. If I evaluate lWalker and lTarget at the iteration where they should be equal, I get that lTarget = 2018-03-01T20:48:47Z lWalker = 2018-03-01T20:48:47.780Z
It seems that calendarForToggleButton sometimes produces dates with non-zero milliseconds which causes the bug. Not sure why.