如何动态更改Google Calendar API的开始/结束日期

时间:2015-10-26 18:25:14

标签: php dynamic google-calendar-api html-form-post

我正在尝试根据使用HTML表单的用户输入动态更改约会日期/时间。

我已成功更改'摘要'& '描述'。但我无法更改约会的开始/结束日期,除非我手动更改代码中的日期。

HTML表格:

<form>
  <label>Service Date<br />
  <input id="when" type="datetime-local" > <!--here I gather date/time -->
  <input type="submit" value="submit">
  </label>
</form>

PHP:

<?php
  $date = $_POST['date'];
  // This Returns : 2015-10-31T14:01

Google Calendar API - 活动创建:

$event = new Google_Service_Calendar_Event(array(
  'summary' => $f_name.' '.$l_name, // This Works
  'location' => '800 Howard St., San Francisco, CA 94103',
    'description' => $when,
    'start' => array(
      'dateTime' => $when, // This Does Not Work
      'timeZone' => 'America/Los_Angeles',
    ),
    'end' => array(
      'dateTime' => $when, // This Does Not Work
      'timeZone' => 'America/Los_Angeles',
    ),
    'recurrence' => array(
      'RRULE:FREQ=DAILY;COUNT=2'
    ),
    'attendees' => array(
      array('email' => 'lpage@example.com'),
      array('email' => $Email), // This Works
    ),
    'reminders' => array(
      'useDefault' => FALSE,
      'overrides' => array(
        array('method' => 'email', 'minutes' => 24 * 60),
        array('method' => 'popup', 'minutes' => 10),
      ),
   ),
));

0 个答案:

没有答案