Closed evgeniy closed 9 months ago
Do you want this to affect only recurring events?
There have already been different discussions to achieve this for regular events: #221
Regarding recurring events, the recurrence rule ("repeat every second monday") is expanded by google itself, the script simply passes it to the API w/o any processing. To achieve the x-days into the future, we would have to edit the recurrence rule to stop at a specific date and filter RDATE properties beyond that date.
As I'm doing it for a calendar that doesn't expose details, similar to #336 it doesn't show which events are re-occurring, only regular events that go indefinitely. Thanks for the suggestion! I was going to add a similar filter. As there is already onlyFutureEvents filter, I added one right after it that looks like this:
if (daysToSync){
daysToSync =+daysToSync; // if string, convert to number
var syncLimitEnd;
syncLimitEnd = new ICAL.Time.fromJSDate(new Date()).adjust(daysToSync,0,0,0); //current date plus the shift of daysToCheck
result = result.filter(function(event){
try{
var eventEnd;
eventEnd = new ICAL.Time.fromString(event.getFirstPropertyValue('dtend').toString());
return ((eventEnd.compare(syncLimitEnd) <= 0));
}catch(e){
return true;
}
});
}
I feel like it would be helpful to add it to the code to extend functionality and remove the need for users to go through the issues and code themselves. Let me know if you agree and I can raise pull request
and remove the need for users to go through the issues and code themselves.
Totally agree. There's an unfinished branch adding the ability to configure filters which will also allow filtering based on start/end date. I'd much rather have that implemented as it covers more use cases than just this specific one.
Sounds great! Looks like it would be a nice addition.
Duplicate of #221
Is your feature request related to a problem? Please describe.
No response
Describe the solution you'd like
add a config variable var daysToCheck = 60; // Number of days from today to include in the sync. Events past this number of days will not be processed.
This way, the script doesn't go years into the future for reoccurring events
Additional context
No response