/** * Finds the first day of the week and returns a day representing the start * of that day. * * @param start * The actual date * @param expandToFullWeek * Should the returned date be moved to the start of the week * @return If expandToFullWeek is set then it returns the first day of the * week, else it returns a clone of the actual date with the time * set to the start of the day */ protected Date expandStartDate(Date start, 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) { start = getFirstDateForWeek(start); } else { start = (Date) start.clone(); } // Always expand to the start of the first day to the end of the last // day start = getStartOfDay(currentCalendar, start); return start; }