Ryan55
Ryan55

Reputation: 1

Google Calendar Date Issue - End dates always incorrect

I am having an issue with the correct dates being pulled down from the Google calendar event API. The problem is related to the end date not being correct. For example, the Google Calendar event for a block might run from 8:30-10, but the event is coming as 8:30 - 7:00. This is affecting all of the results of our request. The code looks like this:

function listUpcomingEvents() {
        gapi.client.calendar.events.list({
          'calendarId': 'atomic55.net_7smfqj9jlem68s42unp0ubr9js@group.calendar.google.com',
          'timeMin': (new Date()).toISOString(),
          'showDeleted': false,
          'singleEvents': true,
          'maxResults': 150,
          'orderBy': 'startTime'
        }).then(function(response) {

The information coming back is (sample):

Upcoming events:

The start time is accurate, but the end time is not (notice how all of the end dates are 7:00). Any idea why this could be the case?

Upvotes: 0

Views: 269

Answers (2)

barry
barry

Reputation: 4147

The -07:00 isn't the end time, it's the time zone offset. See ISO 8601

Upvotes: 0

Ryan55
Ryan55

Reputation: 1

Thanks for your responses. Attached is the output of one event specifically to be compared to. As you can see the time in the UI is set to be from 9-10PST which is correct; however, the query to the API is returning:

Steve Cartner Project End: (2020-09-16T09:00:00-07:00)

https://preview55.com/ryan/gantt/projectoutput.PNG https://preview55.com//ryan/gantt/Capture-projectend.PNG

Upvotes: 0

Related Questions