I have an ical feed I'm importing and everything is working great except one thing.

Here is my repeat rule in the ical feed:

RRULE:FREQ=MONTHLY;BYDAY=TH;BYSETPOS=1

This imports as "every Thursday" instead of "the first Thursday of the month"

If this is not the correct place to post I apologize in advance.
Any suggestions?

Comments

tomdisher’s picture

Title: Every first thursday imported as every thursday » Every first thursday imported as every thursday - Kerio Calendars to Drupal iCal parser
Project: iCal feed parser » Date
Assigned: Unassigned » tomdisher
Status: Active » Closed (works as designed)

Ok. This is a problem with the date module. The date module does not support BYSETPOS=1

I'll post my hack to the feed parser in case anybody else is importing from a Kerio calendar.

foreach ($date_info as $key) {
	   if (isset($event[$key])) 
	   {
        $item->options->VEVENT['DATE'][$key] = $event[$key];
			// if we are on the rule line
			if ($key == 'RRULE')
			{
			if (array_key_exists($event[$key]['BYSETPOS']))
      			{
			$event[$key]['DATA'] = str_replace("BYDAY=","BYDAY=".$event[$key]['BYSETPOS'][0],$event[$key]['DATA']);
			}
			$tempday = $event[$key]['BYDAY'][0];
			$event[$key]['BYDAY'][0]= $event[$key]['BYSETPOS'][0].$tempday;
			$item->options->VEVENT['DATE'][$key] = $event[$key];
			}
        unset($event[$key]);
      }
    }