Reputation: 29
I have script that removes the end day for multi-day events. I want to be able to do the same to remove the start day for multi-day events. Can anyone help?
let excludeEnddate = e.isAllDayEvent() //exclude end date if it's an all day event
function getDaysArray(start, end, excludeEnddate) {
if (excludeEnddate) {
for (var arr = [], dt = new Date(start); dt < new Date(end); dt.setDate(dt.getDate() + 1)) {
arr.push(formatDate(dt));
}
}
else {
for (var arr = [], dt = new Date(start); dt <= new Date(end); dt.setDate(dt.getDate() + 1)) {
arr.push(formatDate(dt));
}
}
return arr;
}
Upvotes: 0
Views: 93
Reputation: 29
Solved it myself. I think the reason I was getting unusual results was having the Google Calendar time zone set to something other than +0.
Upvotes: 1