DateSelector assumes that java.util.Calendar always numbers the first week in a month as one, but it appears that, by default, Calendar will number it zero if it contains less than 4 days. For such months, a week is erroneously added to the date actually clicked on.
To fix:
private void onMouseDown(Event event) {
if (event.button != 1) {
return;
}
forceFocus();
Calendar temp = (Calendar) selectedDate.clone();
// Ensure Calendar instance always numbers first week
// in month as one, never zero!
temp.setMinimalDaysInFirstWeek(1);
Danny Manners
dmanners at amari-metals.com
Logged In: NO
Further investigation reveals java.util.Calendar.getMinimalDaysInFirstWeek() can return a different value for each locale. It's 4 for en-UK. But it's 1 for en-US, so the bug would not have shown itself if testing under English (American).
Logged In: NO
Following on from previous comment, I think my fix is therefore not valid, as it will change week numbering in the Calendar instance returned? Instead, onMouseDown needs a more sophisticated algorithm for determing week number in month.