#135 Recur "BYDAY=29" cannot be inititalised

Release
pending-rejected
Parsing (53)
7
2011-09-16
2011-09-16
Anonymous
No

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());
}
}

Discussion

  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2011-09-16
    • labels: --> Parsing
    • priority: 5 --> 7
     
  • Ben Fortuna

    Ben Fortuna - 2011-09-16
    • assigned_to: nobody --> fortuna
    • status: open --> pending-rejected
     
  • Ben Fortuna

    Ben Fortuna - 2011-09-16

    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

     
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2011-09-16

    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

Log in to post a comment.