Hello all,

Background: I noticed that when I used Feed API to grab a Google calendar and Feed Element Mapper to stuff the VEVENT into a date CCK field, that the EXDATE (exception date for repeating rules) was simply showing up in the db as "/nArray". Hence, the excluded dates were showing up on my calendar.

There's actually two problems:

1. Google's iCal feed, the EXDATE property, isn't per RFC specs. There is a ";" when there should be a ":". (see here: http://drupal.org/node/567614, post 10). That is a problem that is not related to mapper and that I circumvented with a proxy parser.

2. The Feed API data mapper has this in the feedapi_mapper_date_ical() function:

$rrule = $feed_element['RRULE']['DATA'] . (!empty($feed_element['EXDATE']) ? "/n". $feed_element['EXDATE'] : "");
    $form_values = date_ical_parse_rrule($field, $rrule);

See how it appends the EXDATE (which is an array in $feed_element, not text, so that winds up being the literal string "/nArray") to the end of $rrule and then passes that into date_ical_parse_rrule. Well, date_ical_parse_rrule doesn't do anything with that appended value, even if it did show up.
At the end of feedapi_mapper_date_ical(), this is called:
$rrule = date_api_ical_build_rrule($form_values);
It is date_api_ical_build_rrule() that actually builds the RRULE string that is saved in the db, which calendar winds up translating. It looks for an EXDATE key, which won't ever exist because it was never added as a key. Thus, this function doesn't see any EXDATE and simply saves "/nArray".

So here's what I did:
I changed

$rrule = $feed_element['RRULE']['DATA'] . (!empty($feed_element['EXDATE']) ? "/n". $feed_element['EXDATE'] : "");
    $form_values = date_ical_parse_rrule($field, $rrule);

to

$rrule = $feed_element['RRULE']['DATA'];
    $form_values = date_ical_parse_rrule($field, $rrule);
if (!empty($feed_element['EXDATE'])) $form_values['EXDATE'] = $feed_element['EXDATE'];

Rather than appending the literal "/nArray", which does nothing, it creates a new key and adds the value of the array to it. date_api_ical_build_rrule() expects this, saves it to the db, and yay! the calendar sees the EXDATE and excludes it.

So, I guess this is a bug and *my* quickie fix, but I have not delved enough into any of this to know if this fixes all situations, especially non-Google iCal's. But it is something to address, I think, in future releases.

Thanks
Tom