'Events created using the Advanced Calendar API not showing up on Google Calendar Android app
I'm adding all-day events to a calendar using the following code:
function main() {
const response = JSON.parse(UrlFetchApp.fetch(API_URL).getContentText());
const forecasts = response.daily;
deleteEvents_();
forecasts.forEach(e => {
const forecast = new Forecast(e);
console.log(JSON.stringify(forecast));
console.log(forecast.getForecastText());
Calendar.Events.insert(createEvent_(forecast.getForecastText(), forecast.date), CAL_ID);
});
}
function createEvent_(summary, date) {
const formattedDate = DateUtils.toYYYYMMDD(date, "-");
return {
summary: summary,
start: {
date: formattedDate
},
end: {
date: formattedDate
},
transparency: "transparent"
};
}
function deleteEvents_() {
const today = new Date();
const from = DateUtils.addDays(today, -1);
const to = DateUtils.addDays(today, 7);
console.log(`Retrieving events from ${from} to ${to}`);
Calendar.Events.list(CAL_ID, {timeMin: from.toISOString(), timeMax: to.toISOString()}).items.forEach(event => {
console.log(`Deleting: ${event.summary}`);
Calendar.Events.remove(CAL_ID, event.id);
})
}
I can see the events on the web version of Google Calendar but they don't show up on the app. I created another all-day event manually to test, and the one I created manually shows up on both the web version and the app. So next I got the properties of the manually-added event and one of the events I created via my script to see if there was any difference using Calendar.Events.list(CAL_ID, {timeMin: new Date("2022-04-30").toISOString(), timeMax: new Date("2022-05-01").toISOString()});.
Manually-created event:
{
id: 'xxxxxxxx',
creator: { email: '[email protected]' },
end: { date: '2022-05-01' },
created: '2022-05-01T00:49:18.000Z',
etag: '"xxxxxxxx"',
kind: 'calendar#event',
organizer: {
email: '[email protected]',
displayName: 'weather',
self: true },
reminders: { useDefault: false },
htmlLink: 'https://www.google.com/calendar/event?eid=xxxxxxxx',
summary: 'test',
transparency: 'transparent',
updated: '2022-05-01T00:49:18.774Z',
sequence: 0,
start: { date: '2022-04-30' },
iCalUID: '[email protected]',
status: 'confirmed',
eventType: 'default'
}
Script-created event:
{
creator: { email: '[email protected]' },
updated: '2022-05-01T00:28:26.176Z',
htmlLink: 'https://www.google.com/calendar/event?eid=xxxxxxxx',
created: '2022-05-01T00:28:26.000Z',
sequence: 0,
start: { date: '2022-05-01' },
reminders: { useDefault: false },
eventType: 'default',
status: 'confirmed',
etag: '"xxxxxxxx"',
iCalUID: '[email protected]',
end: { date: '2022-05-01' },
organizer: {
self: true,
email: '[email protected]',
displayName: 'weather' },
id: 'xxxxxxxx',
summary: '🌧 (12.97℃-16.41℃)',
transparency: 'transparent',
kind: 'calendar#event'
}
Sorry for the difference in the order of the JSON contents, I copied and pasted the response Google Apps Script gave me (except that I redacted IDs for privacy). But I don't see anything that could result in one being displayed in the Google Calendar Android app and the other not. Am I missing something? What else can I check?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
