/** * Finds the last day of the week and returns a day representing the end of * that day. * * @param end * The actual date * @param expandToFullWeek * Should the returned date be moved to the end of the week * @return If expandToFullWeek is set then it returns the last day of the * week, else it returns a clone of the actual date with the time * set to the end of the day */ protected Date expandEndDate(Date end, boolean expandToFullWeek) { // If the duration is more than week, use monthly view and get startweek // and endweek. Example if views daterange is from tuesday to next weeks // wednesday->expand to monday to nextweeks sunday. If firstdayofweek = // monday if (expandToFullWeek) { end = getLastDateForWeek(end); } else { end = (Date) end.clone(); } // Always expand to the start of the first day to the end of the last // day end = getEndOfDay(currentCalendar, end); return end; }