Open vivimage opened 4 months ago
In theory yes. ical.js has a RecurExpansion class to provide the needed start dates.
Thank you for an insight! Which part of the script will I need to change to add this? Will be grateful, if you can lead me
Try this: add
if (event.hasProperty('rrule')||event.hasProperty('rdate')){
let icalEvent = new ICAL.Event(event, {strictExceptions: true});
let dtstart = event.getFirstPropertyValue('dtstart');
let recExpand = new ICAL.RecurExpansion({component: event, dtstart: dtstart});
let duration = icalEvent.endDate.subtractDate(icalEvent.startDate);
let uid = event.getFirstPropertyValue('uid').toString();
let nextStart;
event.removeProperty('rrule');
event.removeProperty('rdate');
event.removeProperty('exdate');
let i = 0;
while (i < 30 && (nextStart = recExpand.next())){
event.updatePropertyWithValue('dtstart', nextStart);
nextStart.addDuration(duration);
event.updatePropertyWithValue('dtend', nextStart);
event.updatePropertyWithValue('uid', uid + nextStart.toICALString());
icsEventsIds.push('uid', uid + nextStart.toICALString());
let component = new ICAL.Component.fromString(event.toString());
processEvent(component, calendarTz);
i++;
}
return;
}
right above https://github.com/derekantrican/GAS-ICS-Sync/blob/3c36a55aaa61ac6abee037ba7a5e7d8334620b36/Helpers.gs#L291
Thank you! It almost works, but sometimes duplicates an event. Weird that its not always happening. On some reoccurrence it's not happening.
I can't reproduce that, have you done any other changes to the script? What settings are you using?
Default settings, default script. Only with changes you provided. I delete the calendar and let the script create a calendar from scratch.
Seems like it's happening if one event in reccuring series is changed
Seems like it's happening if one event in reccuring series is changed
That makes sense, i'll look into it.
Give this version a try.
There have been changes in various places, i think it's easier to share the whole script than list all changes here.
Thank you very much! Duplicating of events stopped.
I'm noticed one issue. Again only happening with edited events in reccuring series. Its not picking up the change in the timezones, when expanding.
I moved to another country and changed the Google calendar timezone. The expanded event (from edited event in recurring series) haven't picked up the change. So there is difference between original event time and expanded event time.
Again only happening with edited events in reccuring series.
Can you share a minimal *.ics you are testing this with? Google calendar for example 'discards' timezones of recurrence exceptions when exporting the calendar.
I unfortunately deleted the event that was causing the issue.
Any work around that Google discards timezones from recurrence exceptions?
Any work around that Google discards timezones from recurrence exceptions?
No, that's just the way google handles it.
Nevertheless the events should all be at the correct timeslot (albeit in a wrong timezone) in regards to the timezone set in your target calendar. Is that the case?
I can't reproduce the issue that I was having yet. The events were appearing in different timeslots
Started receiving this error on execution.
In this version it's duplicating reccuring exception events with each execution
Still testing it. Works like a charm so far.
The only thing, that I'm noticing, as I understand from looking on a calendar, that for reccuring exception events it first create event in an original position (default time from reccuring event) and then moves to a proper time.
The problem, that I'm noticing, that sometimes it is stuck in an original position for a whole time of execution cycle. And with the next execution it moves itself to a proper place.
Don't really know what causing it. Is there a way to make sure event is not stuck in an original position?
Thank you very much!
Script from above is updated.
Is your feature request related to a problem? Please describe.
No response
Describe the solution you'd like
Is it possible to sync recurring event not as a recurring event but split it up into individual events?
Additional context
No response