Skip to content

Commit

Permalink
Fix multi-value exdate handling
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas0b1011001 authored Oct 1, 2023
2 parents e5cd8e0 + ec5dae6 commit 9990d1b
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions Helpers.gs
Original file line number Diff line number Diff line change
Expand Up @@ -532,10 +532,19 @@ function checkSkipEvent(event, icalEvent){

var exDates = event.getAllProperties('exdate');
exDates.forEach(function(e){
var ex = new ICAL.Time.fromString(e.getFirstValue().toString());
if (ex < newStartDate){
var values = e.getValues();
values = values.filter(function(value){
return (new ICAL.Time.fromString(value.toString()) > newStartDate);
});
if (values.length == 0){
event.removeProperty(e);
}
else if(values.length == 1){
e.setValue(values[0]);
}
else if(values.length > 1){
e.setValues(values);
}
});

var rdates = event.getAllProperties('rdate');
Expand Down

0 comments on commit 9990d1b

Please sign in to comment.