public void testGetDatesRalph() throws ParseException { Recur recur = new Recur("FREQ=WEEKLY;WKST=MO;INTERVAL=1;UNTIL=20051003T000000Z;BYDAY=MO,WE"); Calendar queryStartDate = new GregorianCalendar(TimeZone.getTimeZone(TimeZones.UTC_ID)); queryStartDate.set(2005, Calendar.SEPTEMBER, 3, 0, 0, 0); Calendar queryEndDate = new GregorianCalendar(TimeZone.getTimeZone(TimeZones.UTC_ID)); queryEndDate.set(2005, Calendar.OCTOBER, 31, 23, 59, 0); DateList dateList = recur.getDates(new DateTime(queryStartDate.getTime()), new DateTime(queryStartDate.getTime()), new DateTime(queryEndDate.getTime()), Value.DATE_TIME); log.debug(dateList.toString()); }
log.debug(dates.toString());
/** * This test confirms SETPOS rules are working correctly. * <pre> * The BYSETPOS rule part specifies a COMMA character (US-ASCII decimal * 44) separated list of values which corresponds to the nth occurrence * within the set of events specified by the rule. Valid values are 1 to * 366 or -366 to -1. It MUST only be used in conjunction with another * BYxxx rule part. For example "the last work day of the month" could * be represented as: * * RRULE:FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1 * </pre> */ public final void testSetPosProcessing() { Recur recur = new Recur.Builder().frequency(Frequency.MONTHLY).count(-1) .dayList(new WeekDayList(MO, TU, WE, TH, FR)) .setPosList(new NumberList("-1")).build(); log.debug(recur.toString()); Calendar cal = Calendar.getInstance(); Date start = new DateTime(cal.getTime()); cal.add(Calendar.YEAR, 2); Date end = new DateTime(cal.getTime()); DateList dates = recur.getDates(start, end, Value.DATE_TIME); log.debug(dates.toString()); }
/** * Constructs an <code>ICalDate</code> from an iCalendar date * list. Date lists cannot be anytime. * @param dates The date list. * @throws UnknownTimeZoneException - if something is wrong this exception is thrown. */ public ICalDate(DateList dates) throws UnknownTimeZoneException { value = dates.getType(); tz = dates.getTimeZone(); if (tz != null) { String origId = tz.getID(); tz = tzTranslator.translateToOlsonTz(tz); if (tz == null) { throw new UnknownTimeZoneException(origId); } String id = tz.getVTimeZone().getProperties(). getProperty(Property.TZID).getValue(); tzid = new TzId(id); } text = dates.toString(); this.dates = dates; }
/** * Constructs an <code>ICalDate</code> from an iCalendar date * list. Date lists cannot be anytime. * @param dates The date list. * @throws UnknownTimeZoneException - if something is wrong this exception is thrown. */ public ICalDate(DateList dates) throws UnknownTimeZoneException { value = dates.getType(); tz = dates.getTimeZone(); if (tz != null) { String origId = tz.getID(); tz = tzTranslator.translateToOlsonTz(tz); if (tz == null) { throw new UnknownTimeZoneException(origId); } String id = tz.getVTimeZone().getProperties(). getProperty(Property.TZID).getValue(); tzid = new TzId(id); } text = dates.toString(); this.dates = dates; }