Reputation: 2824
I must be missing something in the api docs, how do I update a Google event timezone via an api request?
$service = new Google_Service_Calendar($client);
$event = $service->events->get($calendarId, $eventId);
$event->setSummary($summary);
$service->events->update($calendarId, $event->getId(), $event);
$start = new Google_Service_Calendar_EventDateTime();
$start->setDateTime($dateTimeStr);
$event->setStart($start);
$event->setTimezone('America/Los_Angeles');
The error message:
Attempted to call an undefined method named "setTimezone" of class "Google_Service_Calendar_Event". (500 Internal Server Error)
Upvotes: 1
Views: 1567
Reputation: 2495
You have to set the timezone on the calendar itself. Don't set it on the event.
See the examples in the documentation:
$calendar = $service->calendars->get('primary');
$calendar->setTimeZone('America/Los_Angeles');
$updatedCalendar = $service->calendars->update('primary', $calendar);
Upvotes: 1