Re: Quarterly appointments

"Mike Samuel" <[email protected]> Tue, 10 Apr 2007 13:43:59 -0700
Newsgroups gmane.ietf.calendar
Message-ID <[email protected]>
Since the quarters have length (90 || 91), (91), (92), (92), the n-th
day of each quarter is
    BYYEARDAY=$(n),$(-(92+92+91+1-n)),$(-(92+92+1-n)),$(-(92+1-n)),
for n in [1, 90]



You can't do
  FREQ=QUARTERLY;BYDAY=2TU
in a single rule with freq=monthly and interval unless you're sure
that the n-th week falls in the first or last month of the quarter.

You can do it with multiple rrules though
  FREQ=YEARLY;BYMONTH=1,2,3;BYDAY=2TU;BYSETPOS=1
  FREQ=YEARLY;BYMONTH=4,5,6;BYDAY=2TU;BYSETPOS=1
  FREQ=YEARLY;BYMONTH=7,8,9;BYDAY=2TU;BYSETPOS=1
  FREQ=YEARLY;BYMONTH=10,11,12;BYDAY=2TU;BYSETPOS=1

The BYSETPOS should always have magnitude 1 but should have the same
sign as the BYDAY clause.

You can do intervals on quarters by filtering out some of the rules
and/or multiplying the set of rules and applying yearly intervals.

Handling multiple BYDAY clauses is going to require a set of RRULEs
per clause though.




On 10/04/07, Sander Koning <[email protected]> wrote:
>
> Hello,
>
> I'm working on iCalendar import/export for the reservations module in
> our product. So far, everything works quite fine, apart from the fact
> that we support quarterly reservations. For example, "every second
> Tuesday of each quarter" or "every 70th day of each odd quarter".
>
> As iCalendar does not support FREQ=QUARTERLY, I will have to rewrite
> these recurrence rules. Of course I can go and calculate everything
> manually in my code, but that is bound to contain errors. So, if anybody
> has got suggestions about how to tackle this, they would be most welcome.
>
> If this is the wrong list to ask, then a pointer to the right place is
> fine as well, of course.
>
> Thanks in advance,
>
> Cheers,
>
> --
> Sander Koning
> TOPdesk Ontwikkeling
>
> TOPdesk
> Martinus Nijhofflaan 2, 2624 ES Delft
> Postbus 559, 2600 AN Delft
>
> T  (015) 270 09 00
> F  (015) 257 52 56
> W  www.topdesk.nl
>
>