How to delete native Calendar events with recurrence?


#1

Hello, I created events with native Calendar with recurrence and need delete this events, but in docs don’t have a method “deleteEventWithOptions”, I tried just call deleteEvent(title, location, notes, null, null) and deleteEvent(title, location, notes), but both of then won’t work.
Have any way to do this without create a loop range date, because the recurrence is ‘infinite’.

Here is my dependencies from package.json:


"dependencies": {
    "@angular/common": "4.0.0",
    "@angular/compiler": "4.0.0",
    "@angular/compiler-cli": "4.0.0",
    "@angular/core": "4.0.0",
    "@angular/forms": "4.0.0",
    "@angular/http": "4.0.0",
    "@angular/platform-browser": "4.0.0",
    "@angular/platform-browser-dynamic": "4.0.0",
    "@ionic-native/calendar": "^3.5.0",
    "@ionic-native/camera": "^3.5.0",
    "@ionic-native/core": "^3.6.0",
    "@ionic-native/date-picker": "^3.5.0",
    "@ionic-native/facebook": "^3.4.4",
    "@ionic-native/file": "^3.5.0",
    "@ionic-native/file-path": "^3.5.0",
    "@ionic-native/geolocation": "^3.6.1",
    "@ionic-native/google-plus": "^3.4.4",
    "@ionic-native/keyboard": "^3.4.4",
    "@ionic-native/local-notifications": "^3.5.0",
    "@ionic-native/native-storage": "^3.4.4",
    "@ionic-native/splash-screen": "3.4.2",
    "@ionic-native/status-bar": "3.4.2",
    "@ionic-native/themeable-browser": "^3.6.1",
    "@ionic-native/transfer": "^3.5.0",
    "@ionic/storage": "2.0.1",
    "angular2-text-mask": "^8.0.0",
    "ionic-angular": "3.0.1",
    "ionicons": "3.0.0",
    "rxjs": "5.1.1",
    "sw-toolbox": "3.4.0",
    "zone.js": "^0.8.4"
  }

Thanks.


#2

Anyone can help about it?


#3

(I changed your post to format your code or error message correctly. Please use the </> button above the post input field to format your code or error message or wrap it in ``` (“code fences”) manually. This will make sure your text is readable and if it recognizes the programming language it also automatically adds code syntax highlighting. Thanks.)

You are talking about https://ionicframework.com/docs/native/calendar/ I assume?
What is the code you use to add the event?
Have you tried one of the “instances” of the event and looked if it deleted the whole “sequence”?

The underlying Cordova plugin offers only the deleteEvent function, too: https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin So you might want to open an issue there and ask how recurring events should be deleted.


#4

Thank you for advices, it was my first post in forum.
Yes, I using Calendar from https://ionicframework.com/docs/native/calendar/, used createEventWithOptions(title, eventLocation, notes, startDate, endDate, options) to create recurrence, I tried a few deleteEvents() “formats”, but just deleted the event with all data matchs.
Yes, I’ll open an issue there https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin, one more time, thank you for advices about how to post in forum and redirect me.


#5

Sure. Interesting problem you have with the recurrence.


#6

Hi guys, I come here to show my solution to this problem if someone has it in the future.

Use endDate = startDate + X years to have a boundary to delete the events. I think no one needs infinite recurrence events.

Also, to better performance in IOS, I used this solution https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin/issues/150