Skip to content

Commit

Permalink
Improved recurrence handling
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas0b1011001 committed Oct 31, 2019
1 parent f4d77c3 commit acaba76
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Helpers.gs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ function processEvent(event, calendarTz){
*/
function createEvent(event, calendarTz){
event.removeProperty('dtstamp');
var icalEvent = new ICAL.Event(event);
var icalEvent = new ICAL.Event(event, {strictExceptions: true});
if (onlyFutureEvents && checkSkipEvent(event, icalEvent)){
return;
}
Expand Down Expand Up @@ -300,7 +300,7 @@ function createEvent(event, calendarTz){
if (addAlerts){
var valarms = event.getAllSubcomponents('valarm');
if (valarms.length == 0){
newEvent.reminders = { 'useDefault' : true };
newEvent.reminders = { 'useDefault' : true, 'overrides' : []};
}
else{
var overrides = [];
Expand Down
7 changes: 5 additions & 2 deletions ical.js.gs
Original file line number Diff line number Diff line change
Expand Up @@ -8789,6 +8789,7 @@ ICAL.Event = (function() {
* @type {ICAL.Event[]}
*/
exceptions: null,
except: [],

/**
* When true, will verify exceptions are related by their UUID.
Expand Down Expand Up @@ -8817,15 +8818,17 @@ ICAL.Event = (function() {
}

if (this.strictExceptions && obj.uid !== this.uid) {
throw new Error('attempted to relate unrelated exception');
//throw new Error('attempted to relate unrelated exception');
}
else{
this.except.push(obj);
}

var id = obj.recurrenceId.toString();

// we don't sort or manage exceptions directly
// here the recurrence expander handles that.
this.exceptions[id] = obj;
this.except.push(obj);

// index RANGE=THISANDFUTURE exceptions so we can
// look them up later in getOccurrenceDetails.
Expand Down

0 comments on commit acaba76

Please sign in to comment.