Hi Isomorphic,
After upgrading to SmartClient Version: v12.1p_2021-10-22/Pro Deployment (built 2021-10-22), the DayBodyClickHandler for the Calendar gets the correct date, but the time is now 12:00:00 instead of 00:00:00.
This is causing the dates to no longer be equal when comparing them in the getDayBodyHTML method since it is passed a date with time 00:00:00.
The following sample code can be used to reproduce the issue. After clicking on a date, it should display a checkmark but it doesn't because the date objects are not equal.
Entry Point:
Thanks.
After upgrading to SmartClient Version: v12.1p_2021-10-22/Pro Deployment (built 2021-10-22), the DayBodyClickHandler for the Calendar gets the correct date, but the time is now 12:00:00 instead of 00:00:00.
This is causing the dates to no longer be equal when comparing them in the getDayBodyHTML method since it is passed a date with time 00:00:00.
The following sample code can be used to reproduce the issue. After clicking on a date, it should display a checkmark but it doesn't because the date objects are not equal.
Entry Point:
Code:
public class Sandbox19 implements EntryPoint {
private Set<Date> dates = new TreeSet<>();
public void onModuleLoad() {
Calendar calendar = new Calendar() {
@Override
public String getDayBodyHTML(Date date, CalendarEvent[] events, Calendar calendar, int rowNum, int colNum) {
String returnStr = date.getDate() + "";
if (dates.contains(date)) {
returnStr += imgHTML("icons/16/approved.png", 16, 16, "image", null, null);
}
return returnStr;
}
};
calendar.setWidth(500);
calendar.setHeight(220);
calendar.setShowDayView(false);
calendar.setShowWeekView(false);
calendar.setShowOtherDays(false);
calendar.setShowDayHeaders(false);
calendar.setShowDatePickerButton(false);
calendar.setShowAddEventButton(false);
calendar.setDisableWeekends(false);
calendar.setShowDateChooser(false);
calendar.setCanCreateEvents(false);
calendar.addDayBodyClickHandler(event -> {
Date date = event.getDate();
if (dates.contains(date)) {
dates.remove(date);
} else {
dates.add(date);
}
calendar.markForRedraw();
});
calendar.draw();
}
}
Comment