google-calendar icon indicating copy to clipboard operation
google-calendar copied to clipboard

Events Insert

Open DenisMrGnusa opened this issue 5 years ago • 0 comments

Please help, I have tried creating new events using this package, my code is like this : var google_calendar = new gcal.GoogleCalendar(req.user.token); var resource = { 'summary': 'Google I/O 2019', 'location': '800 Howard St., San Francisco, CA 94103', 'description': 'A chance to hear more about Google's developer products.', "guestsCanInviteOthers": false, 'start': { 'dateTime': '2019-01-27T04:00:00+07:00', 'timeZone': 'Asia/Jakarta', }, 'end': { 'dateTime': '2019-01-28T04:00:00+07:00', 'timeZone': 'Asia/Jakarta', }, "attachments": [ { "fileId": "1", "fileUrl": "https://gnusa.id/asset/img/preloader-image-retina-2.png", "iconLink": "https://gnusa.id/asset/img/preloader-image-retina-2.png", "mimeType": "image/png", "title": "Logo Gnusa" } ], 'attendees': [ { 'email': '[email protected]', "displayName": "Denis Muhammad Ramdan", "comment": "Pembicara dari PT. Gateway Internusa", "organizer": false } ], 'reminders': { 'useDefault': false, 'overrides': [ {'method': 'email', 'minutes': 24 * 60}, {'method': 'popup', 'minutes': 10} ], }, };

google_calendar.events.insert('primary',{
	'sendNotifications': true,
	'resource': resource,
}, function(err, event) {
	if (err) {
		console.log('There was an error contacting the Calendar service: ' + JSON.stringify(err));
		return;
	}
	console.log('Event created: %s', event.htmlLink);
});

when the function is executed, the return results are as follows:

There was an error contacting the Calendar service: {"errors":[{"domain":"global","reason":"required","message":"Missing end time."}],"code":400,"message":"Missing end time."}

and the event does not enter the calendar, my question, why did that happen? Am I writing wrong? if yes, how is the correct writing, thank you

DenisMrGnusa avatar Jan 17 '19 15:01 DenisMrGnusa