Reputation: 23
going out of my mind and hope for some insight-i am inserting an event by way of google javascript and all day event does not seem to want to work-can easily do a single non all day event, but seems as though "date" doesnt work
var strttime = new Date('[@scheduledfor]');
var endtie = new Date('[@scheduledfortime]');
var endtie2 = new Date('2016-12-01');
var endtie3 = new Date('2016-12-01');
var request = gapi.client.calendar.events.insert({
calendarId: 'cal is correct',
start:{
date:new Date('2016-12-11')
},
end:{
date:new Date('2016-12-11')
},
any help is appreciated-like i said if i change date to dateTime works no problem, but as soon as i call for date for all day it breaks and returns global not found -even works in the try it of google, have tried end.date, set.start, any help is greatly appreciated
as a result of an answer i have tried this and it doen not work either-returns 404-i have tried before this although will post now
var endtie2 = new Date('2016-12-13');
var endtie3 = new Date('2016-12-13');
var request = gapi.client.calendar.events.insert({
calendarId: 'a good calendar',
start: {
date: [endtie3],
timeZone: 'America/New_York'},
end: {
date: [endtie3],
timeZone: 'America/New_York'},
Upvotes: 2
Views: 10304
Reputation: 199
When you are inserting events in Google Calendar, it is necessary to mention timezone for start and end time.
Upvotes: 0
Reputation: 17613
Try referring to the events.insert sample and the Javascript quickstart from the docs:
// Refer to the JavaScript quickstart on how to setup the environment:
// https://developers.google.com/google-apps/calendar/quickstart/js
// Change the scope to 'https://www.googleapis.com/auth/calendar' and delete any
// stored credentials.
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': {
'dateTime': '2015-05-28T09:00:00-07:00',
'timeZone': 'America/Los_Angeles'
},
'end': {
'dateTime': '2015-05-28T17:00:00-07:00',
'timeZone': 'America/Los_Angeles'
},
'recurrence': [
'RRULE:FREQ=DAILY;COUNT=2'
],
'attendees': [
{'email': '[email protected]'},
{'email': '[email protected]'}
],
'reminders': {
'useDefault': false,
'overrides': [
{'method': 'email', 'minutes': 24 * 60},
{'method': 'popup', 'minutes': 10}
]
}
};
var request = gapi.client.calendar.events.insert({
'calendarId': 'primary',
'resource': event
});
request.execute(function(event) {
appendPre('Event created: ' + event.htmlLink);
});
Upvotes: 4