Code cleanup in setSelectedDate()