Missing End Time Google Calendar
Asked Answered
G

3

10

Here is my google calendar request. In the response, the error code is "Missing End Time." I'm trying to make this dynamic, so I will end up removing the hard coded start and end dateTimes.

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);
Graf answered 28/7, 2014 at 7:35 Comment(2)
When I type this exact same thing into my Google Developers Console example it works.Graf
... and here https://mcmap.net/q/1167200/-quot-missing-end-time-quot-with-google-calendar-and-racket-google-package?rq=1Signify
G
6

This guy had the answer

https://groups.google.com/forum/#!msg/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);
Graf answered 28/7, 2014 at 7:52 Comment(0)
S
1

Probably, the reason of this error not wrong time. Probably, Calendar API can't recognize you json. Header of http-request MUST contain "Content-Type: application/json". See here http://devsplanet.com/question/37535563

Signify answered 9/9, 2017 at 5:16 Comment(1)
@GhostCat He has actually valid point... I had bad encoding in "location" tag and because of that Google didn't read the ending time.Rivera
S
0

This worked for me:

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
      })
Sipper answered 20/1, 2020 at 11:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.