1

Using the PHP Client Library, I'm trying to create a weekly recurring event that will skip on days when we are closed for business.

I'm passing these parameters to make a new Google_Service_Calendar_Event object that gets passed to Google_Service_Calendar::events->update().

$params = array(
    'summary' => 'Event Title',
    'location' => 'Event Location',
    'start' => array(
        'dateTime' => $slot['startDate'].'T'.$slot['startTime'],
        'timeZone' => 'America/New_York',
    ),
    'end' => array(
        'dateTime' => $slot['startDate'].'T'.$slot['endTime'],
        'timeZone' => 'America/New_York',
    ),
    'recurrence' => $arrRecurrence,
    'attendees' => $arrAttendees,
);

$arrRecurrence has rules dictating that the event should repeat weekly until the end of February, skipping Presidents' Day:

Array
(
    [0] => EXDATE;VALUE=DATE:20180219
    [1] => RRULE:FREQ=WEEKLY;UNTIL=20180224;BYDAY=MO
)

The RRULE is being applied correctly, but the EXDATE is being ignored and I can't seem to figure out why.

Peter Li
  • 410
  • 1
  • 3
  • 13
  • 1
    Since there is a time zone in start and end dates try `EXDATE;TZID=America/New_York;VALUE=DATE:20180219`, https://stackoverflow.com/questions/25170070/google-calendar-api-rrule-and-exdate – Danijel Jan 31 '18 at 12:57
  • tried, but looks like it's ignored. after inserting the event, I did a `get()` and the `TZID` wasn't in the `EXDATE` rule. i think it's not valid because i'm specifying a date and not a date-time – Peter Li Feb 07 '18 at 21:16

1 Answers1

0

EXDATE must be in the same format as the values for start and end. In this case, that means EXDATE needs an additional time component, and a timezone.

EXDATE;TZID=America/New_York;VALUE=DATE:20180219T000000Z
Stratadox
  • 1,291
  • 8
  • 21
  • tried, but looks like it's ignored. after inserting the event, I did a `get()` and the `TZID` wasn't in the `EXDATE` rule. i think it's not valid because i'm specifying a date and not a date-time – Peter Li Feb 07 '18 at 21:17
  • `;VALUE=DATE` should be removed here; it makes the expression invalid. – equaeghe Mar 25 '22 at 09:45