RRULE INTERVAL != 1 calculated incorrectly

Wm
2004-07-31
2013-03-07
  • Wm

    Wm - 2004-07-31

    I have a number of VEVENTS with INTERVALs not equal to 1 where jical is getting the first date wrong.

    Here is an example:

    BEGIN:VEVENT
    UID
    :2a11d020-d722-11d8-a5a2-ce254eadc6e4
    SUMMARY
    :Library
    STATUS
    :TENTATIVE
    CLASS
    :PRIVATE
    X-MOZILLA-RECUR-DEFAULT-INTERVAL
    :3
    RRULE
    :FREQ=WEEKLY;INTERVAL=3;BYDAY=FR
    DTSTART
    ;VALUE=DATE
    :20040716
    DTEND
    ;VALUE=DATE
    :20040717
    DTSTAMP
    :20040716T121738Z
    LAST-MODIFIED
    :20040731T082743Z
    END:VEVENT

    jical produces the sequence

    20040716
    20040723 # i.e. + 1 week not 3
    20040813
    20040903
    20040924
    etc.

    I will try to look at the code but it is the first time I have played Java so it may be quicker if someone else can look at this.

    Otherwise I like jical a lot.  Thank you.
    --
    Wm

     
    • Wm

      Wm - 2004-07-31

      I wrote: "jical is getting the first date wrong"

      should have been "jical is getting the first recurring date wrong".  The first date is right and those subsequent to the first calculated date (the second in my example) are correct too (based on the wrong date).

      I am sure the problem is in iCalendar.java
      and probably "public void processRepeatEvent()"
      but as this is my first go at examining java code closely I haven't got further than that in identifying the problem but _think_ it might be to do with dateConstraint being altered by mistake.

      I am also not sure if I am talking to the ether here and if someone can suggest a better place I'd happily take my problem (and hopefully eventual solution) up there.
      --
      Wm

       
    • Wm

      Wm - 2004-08-01

      here is the fix

      diff -cw iCalendar.jav*

      *** iCalendar.java    Sun Aug 01 10:40:28 2004
      --- iCalendar.java.bak    Sun Aug 01 10:38:26 2004
      ***************
      *** 307,324 ****
                        Calendar repeatDateEnd   = new GregorianCalendar();
                        repeatDateEnd.setTime(icalEvent.getDateEnd());
       
      -                 processRepeatEvent(repeatDateStart, repeatDateEnd, icalEvent.getRepeatRules(), icalEvent.getRepeatRules().dateRepeatUnit, icalEvent, timeFrom, timeTo);
      -                 if (icalEvent.getRepeatRules().dateRepeatUnit == Calendar.DAY_OF_WEEK)
      -                 {
      -                     repeatDateStart.add(Calendar.DATE, 7 * icalEvent.getRepeatRules().interval);
      -                     repeatDateEnd.add(Calendar.DATE, 7 *icalEvent.getRepeatRules().interval);
      -                 }
      -                 else
      -                 {
      -                     // Next repeat date to check.
                            repeatDateStart.add(icalEvent.getRepeatRules().dateRepeatUnit, icalEvent.getRepeatRules().interval);
                            repeatDateEnd.add(icalEvent.getRepeatRules().dateRepeatUnit, icalEvent.getRepeatRules().interval);
      -                 }
       
                        if (icalEvent.getRepeatRules().repeatUntilDate == null)
                            icalEvent.getRepeatRules().repeatUntilDate = dateTo;
      --- 307,314 ----

       
      • Wm

        Wm - 2004-08-01

        stet that

        lets try again and see if we can get better formatting and without the bum pasting error

        diff -cw iCalendar.jav*

        <pre>
        *** iCalendar.java    Sun Aug 01 10:58:26 2004
        --- iCalendar.java.bak    Sun Aug 01 10:38:26 2004
        ***************
        *** 307,323 ****
                          Calendar repeatDateEnd   = new GregorianCalendar();
                          repeatDateEnd.setTime(icalEvent.getDateEnd());
         
        -                 if (icalEvent.getRepeatRules().dateRepeatUnit == Calendar.DAY_OF_WEEK)
        -                 {
        -                     repeatDateStart.add(Calendar.DATE, 7 * icalEvent.getRepeatRules().interval);
        -                     repeatDateEnd.add(Calendar.DATE, 7 *icalEvent.getRepeatRules().interval);
        -                 }
        -                 else
        -                 {
        -                     // Next repeat date to check.
                              repeatDateStart.add(icalEvent.getRepeatRules().dateRepeatUnit, icalEvent.getRepeatRules().interval);
                              repeatDateEnd.add(icalEvent.getRepeatRules().dateRepeatUnit, icalEvent.getRepeatRules().interval);
        -                 }
         
                          if (icalEvent.getRepeatRules().repeatUntilDate == null)
                              icalEvent.getRepeatRules().repeatUntilDate = dateTo;
        --- 307,314 ----

        </pre>

         
    • Wm

      Wm - 2004-08-01

      bah, I give up

       
    • Stuart Guthrie

      Stuart Guthrie - 2004-11-04

      Wm,

      I've implemented decent unit testing for jical now. If you could post an iCalendar with a single VEVENT that is stuffing up, I'll add it to the unit tests, debug it and ensure it continues to work.

      Stuart Guthrie

       
      • Wm

        Wm - 2004-11-04

        the event from the first post in this thread should do for the test.  if you want an actual ics file where should I post it ? (I always seem to lose formatting if I add things like that to a thread).

         
    • Stuart Guthrie

      Stuart Guthrie - 2004-11-05

      Hi  Wm, I'm off line @ eurekait.com at the moment, moving providors and the telco is stuffing up here in Aus as usual. I'll endeavour to work with your example above, try sfg@eurekait.com in a week if you've a better example.

       

Log in to post a comment.