Skip to content

Commit 9990d1b

Browse files
Fix multi-value exdate handling
2 parents e5cd8e0 + ec5dae6 commit 9990d1b

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

Helpers.gs

+11-2
Original file line numberDiff line numberDiff line change
@@ -532,10 +532,19 @@ function checkSkipEvent(event, icalEvent){
532532

533533
var exDates = event.getAllProperties('exdate');
534534
exDates.forEach(function(e){
535-
var ex = new ICAL.Time.fromString(e.getFirstValue().toString());
536-
if (ex < newStartDate){
535+
var values = e.getValues();
536+
values = values.filter(function(value){
537+
return (new ICAL.Time.fromString(value.toString()) > newStartDate);
538+
});
539+
if (values.length == 0){
537540
event.removeProperty(e);
538541
}
542+
else if(values.length == 1){
543+
e.setValue(values[0]);
544+
}
545+
else if(values.length > 1){
546+
e.setValues(values);
547+
}
539548
});
540549

541550
var rdates = event.getAllProperties('rdate');

0 commit comments

Comments
 (0)