Google PHP客户端库"全天"事件重复

时间:2014-12-15 03:36:09

标签: php google-api

这是我的代码

    if($service instanceof Google_Service_Calendar and isset($_SESSION['service_token']) and $_SESSION['service_token'] != '' ) {
                        $event = new Google_Service_Calendar_Event();
                        $event->setSummary('AllDay Event Bug');
                        $start = new Google_Service_Calendar_EventDateTime();
                        $start->setDateTime(date('Y-m-d\TH:i:s',strtotime('2015-11-11 10:00:00')));
                        $start->setTimeZone('Australia/Melbourne');
                        $event->setStart($start);
                        $end = new Google_Service_Calendar_EventDateTime();
                        $end->setDateTime(date('Y-m-d\TH:i:s',strtotime('2015-11-16 11:00:00')));
                        $end->setTimeZone('Australia/Melbourne');
                        $event->setEnd($end);
                        if(recurring) {

                            $recurrenceUntil = date('Ymd\THis\Z',strtotime('2015-11-16 11:00:00'));

                            if(count($exDateArr) > 0) {
                                $exdate = "EXDATE:".implode(",", $exDateArr);
                            } else {
                                $exdate = '';
                            }


                            switch ($repeate) {
                                case "day":
                                    $frequence = "DAILY";
                                    break;
                                case "week":
                                    $frequence = "WEEKLY";
                                    break;
                                case "month":
                                    $frequence = "MONTHLY";
                                    break;
                                case "year":
                                    $frequence = "YEARLY";
                                    break;
                            }

                            $event->setRecurrence(
                                array(
                                    "RRULE:FREQ=".$frequence.";UNTIL=".$recurrenceUntil.";INTERVAL=".$repeate_interval,
                                    $exdate
                                )
                            );

                        }

                        $newEvent = $service->events->insert('primary', $event);

}

当我在Google日历中搜索该事件时,这就是我得到的结果。

Wed Nov 11, 2015   10:00am – 11:00am  AllDay Event Bug

Thu Nov 12, 2015   All day            AllDay Event Bug
                   10:00am – 11:00am  AllDay Event Bug

Fri Nov 13, 2015   All day            AllDay Event Bug
                   All day            AllDay Event Bug
                   10:00am – 11:00am  AllDay Event Bug

Sat Nov 14, 2015   All day            AllDay Event Bug
                   All day            AllDay Event Bug
                   All day            AllDay Event Bug
                   10:00am – 11:00am  AllDay Event Bug

Sun Nov 15, 2015   All day            AllDay Event Bug
                   All day            AllDay Event Bug
                   All day            AllDay Event Bug
                   All day            AllDay Event Bug
                   10:00am – 11:00am  AllDay Event Bug

Mon Nov 16, 2015   All day            AllDay Event Bug
                   All day            AllDay Event Bug
                   All day            AllDay Event Bug
                   All day            AllDay Event Bug
                   All day            AllDay Event Bug
                   10:00am – 11:00am  AllDay Event Bug

第一天一切都很好,第二天开始增加额外的“全天”活动,每天都会增加。任何人都可以告诉我为什么会这样? 我正在使用Google服务帐户凭据,我添加的活动不是经常性的,并且没有例外日期。

0 个答案:

没有答案