Subject: Re: Seeking RRULE evaluation guidance

From: Doug Royer <[email-masked]>
Date: Fri, 14 Jul 2000 10:57:28 -0700

[email-masked] wrote:
> 
> Warning: This is a rather long posting in an effort to be as clear as I
> can on my quandry!!
> 
>   Ok, after trying to figure out how some seemingly simple RRULE cases
> should be handled Ive come to the opinion that the RFC is not clear
> enough on the topic of evaluation for some cases.  The RFC has some good
> examples (thanks again Derik & Frank) but it is unclear how a recurrence
> rule should be evaluated when the FREQUENCY value is less than a BY*
> value, the INTERVAL is > 1 and the BY* is _NOT_ contiguous.
> 
>   For example with the following contiguous BYMONTH, just what are the
> rolled out values for the following:
> 
> DTSTART;TZID=US-Eastern:20000628T09000
> DTEND;TZID=US-Eastern:20000628T093000
> RRULE:FREQ=DAILY;COUNT=5;INTERVAL=4;BYMONTH=6,7
> 
> Should it be:

What if it said INTERVAL=1:

DTSTART;TZID=US-Eastern:20000628T09000
DTEND;TZID=US-Eastern:20000628T093000
RRULE:FREQ=DAILY;COUNT=5;INTERVAL=1;BYMONTH=6,7

You would expect it to be every day for 5 days - correct?

The fact that INTERVAL is 4 should make no difference, it should
happen every 4th day, and happen 5 times DAILY.

Or your other example:

> DTSTART;TZID=US-Eastern:20000628T09000 
> DTEND;TZID=US-Eastern:20000628T093000 
> RRULE:FREQ=DAILY;COUNT=5;INTERVAL=4;BYMONTH=6,8 

Same issue.  If the INTERVAL was 1, what would it do?
It would skip month 7 and continue.

It is much like the example in RFC-2445 (below), except your example
has only have one instance repeated 5 times.

(From section 4.3.10)

   Here is an example of evaluating multiple BYxxx rule parts.

     DTSTART;TZID=US-Eastern:19970105T083000
     RRULE:FREQ=YEARLY;INTERVAL=2;BYMONTH=1;BYDAY=SU;BYHOUR=8,9;
      BYMINUTE=30

   First, the "INTERVAL=2" would be applied to "FREQ=YEARLY" to arrive
   at "every other year". Then, "BYMONTH=1" would be applied to arrive
   at "every January, every other year". Then, "BYDAY=SU" would be
   applied to arrive at "every Sunday in January, every other year".
   Then, "BYHOUR=8,9" would be applied to arrive at "every Sunday in
   January at 8 AM and 9 AM, every other year". Then, "BYMINUTE=30"
   would be applied to arrive at "every Sunday in January at 8:30 AM and
   9:30 AM, every other year". Then, lacking information from RRULE, the
   second is derived from DTSTART, to end up in "every Sunday in January
   at 8:30:00 AM and 9:30:00 AM, every other year". Similarly, if the
   BYMINUTE, BYHOUR, BYDAY, BYMONTHDAY or BYMONTH rule part were
   missing, the appropriate minute, hour, day or month would have been
   retrieved from the "DTSTART" property.

-Doug

---

From: [email-masked]
Date: Fri, 14 Jul 2000 16:15:48 -0400

>What if it said INTERVAL=1:

The key of the question is that the BY* are NONCONTIGUOUS.  I used 
INTERVAL=4 because it would give you different results based on HOW the 
person evaluates the BY* components (Note that the initial value is NOT in 
July so having an INTERVAL affects what values you reach in July, 
depending on how you roll out the BY*.)

So, what is your answer to my set of rollouts with INTERVAL=4??  W/o this, 
we cannot discuss the NONCONTIGUOUS set of BY* values that follow...

>happen every 4th day, and happen 5 times DAILY.

Ok, Im still looking to see what set of dates you say is the proper 
answer...  What Im trying to understand is how you think BY* sets should 
be evaluated: 

1: Do you treat BYMONTH=6,7 as 2 separate 'sets' and start evaluating 
BYMONTH=6 @ 28-June and BYMONTH=7 @ 1-July or
2: Do you treat BYMONTH=6,7 as 1 continuous 'set' and just 'roll into' 
July and account for the days you already skipped in June?

Logically I think most folks would do #2.  However the wrench Im wrestling 
with involves NONCONTINUOUS sets like BYMONTH=6,8.

>     RRULE:FREQ=YEARLY;INTERVAL=2;BYMONTH=1;BYDAY=SU;BYHOUR=8,9;

Key observations to be made about this counter example:

1: BYMONTH is a single value
2: BYDAY is a single value
3: BYHOUR is a CONTIGUOUS set
4: BYMINUTE is a single value

Simplify the counter example to a fewer set of BY* and make one 
NONCONTIGUOUS.  Then you can see why some collective wisdom is necessary 
(at least from where I sit in my office)...

>It would skip month 7 and continue.

Just what do you mean by 'skip month 7'??  Do I treat BYMONTH=6,8 as a 
contiguous set (and just 'roll into' like in #2 above)?  Do you 'roll into 
and thru' month 7 and keep going into month 8?  (This is why I picked 
June/July/August and INTERVAL=4; you get different roll outs based on what 
you consider 'skipping month 7'...

Bruce
===========================================================================
Bruce Kahn                                INet: [email-masked]
Iris Associates                          Phone: 978.392.5335
Westford, MA, USA 01886                    FAX: and nothing but the FAX...
Standard disclaimers apply, even where prohibited by law...