From ec5dae6c5b96cd66641ecbba16cd4c1d1294e7c1 Mon Sep 17 00:00:00 2001 From: jonas0b1011001 <43352574+jonas0b1011001@users.noreply.github.com> Date: Fri, 16 Jun 2023 19:54:35 +0200 Subject: [PATCH] multi-value exdates Fix multi-value exdate handling with onlyFutureEvents = true --- Helpers.gs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Helpers.gs b/Helpers.gs index 4cfe250..918b541 100644 --- a/Helpers.gs +++ b/Helpers.gs @@ -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');