丢失的结束时间谷歌日历



这是我的谷歌日历请求。在响应中,错误代码是"Missing End Time"。我试图使这个动态,所以我将最终删除硬编码的开始和结束日期时间。

var object = {
        "end": {
            'dateTime': "2014-07-28T23:00:00",//end,
            "timeZone": timeZone
        },
        "start": {
            'dateTime': "2014-07-28T18:00:00",//start,
            "timeZone": timeZone
        },
        "calendarId": calendarId,
        "summary": artist,
        "description": description,
        "location": address
    };
    var request = gapi.client.calendar.events.insert(object);

这家伙有答案

https://groups.google.com/forum/!味精/google-calendar-api/cnkgXfy_GQQ/SRV1N0TAGtYJ

    var object = {
        'end': {
            'dateTime': '2014-07-28T23:00:00',//end,
            'timeZone': timeZone
        },
        'start': {
            'dateTime': '2014-07-28T18:00:00',//start,
            'timeZone': timeZone
        }
        //'summary': artist,
        //'description': description,
        //'location': address
    };
    var calendarObject =
    {
        'calendarId': calendarId,
        'resource': object
    };
    var request = gapi.client.calendar.events.insert(calendarObject);

可能,这个错误的原因不是错误的时间。可能,日历API不能识别你的json。http-request头必须包含"Content-Type: application/json"。详见http://devsplanet.com/question/37535563

这对我有用:

var event = {
      summary: "Google I/O 2015",
      location: "800 Howard St., San Francisco, CA 94103",
      description: "A chance to hear more about Google's developer products.",
      start: {
        date: "2020-05-28"
      },
      end: {
        date: "2020-05-29"
      }
    };
    gapi.client.calendar.events
      .insert({
        calendarId: calendarId,
        resource: event
      })

相关内容

  • 没有找到相关文章

最新更新