Dear all, I ran into a serious bug with my tests after updating from ical4j-1.0-rc1 to the release 1.0. The release introduced WeekDay.validateDay() that is called by the constructor. Unfortunately this checks for SU, MO, TU etc. only and not for day of month like 23, 24, 25 etc. As a consequence a RRule like "FREQ=MONTHLY;INTERVAL=2;BYDAY=29" cannot be instantiated although it is valid and given in multiple examples in the ical4j Wiki. I added a simple junit test:
import static org.junit.Assert.assertEquals;
import java.text.ParseException;
import net.fortuna.ical4j.model.property.RRule;
import org.junit.Test;
public class RRuleTest {
/**
* Tests the initialisation of an RRule from a String. The example is taken
* from the <a
* href="http://wiki.modularity.net.au/ical4j/index.php?title=Recur">ical4j
* wiki</a>.
* @throws ParseException
* In case parsing fails
*/
@Test
public void testRRuleInit() throws ParseException {
final RRule rrule = new RRule("FREQ=MONTHLY;INTERVAL=2;BYDAY=29");
assertEquals("RRule values should equal.", "FREQ=MONTHLY;INTERVAL=2;BYDAY=29", rrule
.getValue());
}
}
View and moderate all "bugs Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Bugs"
Hi,
To specify a day of the month in a recurrence rule use BYMONTHDAY=xx, eg:
FREQ=MONTHLY;INTERVAL=2;BYMONTHDAY=29
Unfortunately the example in the wiki was wrong, I have updated it now.
regards,
ben
View and moderate all "bugs Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Bugs"
Hi Ben, thanks very much for the quick reply. The RFC 2445 says you're right!
Thanks again
Hendrik
Last edit: Anonymous 2015-01-02