question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SaveEvent in a calendar getting deleted after viewing

See original GitHub issue

I am using this package from last 1 year, i am facing issue after upgrading the react-native project to 0.59.10. When an event is created from application, save Event is returning ID and Event is saved In Phone but when i viewed in Calendar It will get deleted.

Environment

React Native Environment Info: System: OS: macOS 10.14.5 CPU: (8) x64 Intel® Core™ i7-4770HQ CPU @ 2.20GHz Memory: 1006.73 MB / 16.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 10.15.1 - /usr/local/bin/node npm: 6.4.1 - /usr/local/bin/npm SDKs: iOS SDK: Platforms: iOS 12.4, macOS 10.14, tvOS 12.4, watchOS 5.3 Android SDK: API Levels: 23, 25, 26, 27, 28 Build Tools: 28.0.2, 28.0.3 System Images: android-23 | Google APIs Intel x86 Atom, android-27 | Google Play Intel x86 Atom, android-28 | Google Play Intel x86 Atom IDEs: Android Studio: 3.4 AI-183.6156.11.34.5692245 Xcode: 10.3/10G8 - /usr/bin/xcodebuild npmPackages: react: 16.8.3 => 16.8.3 react-native: 0.59.10 => 0.59.10 npmGlobalPackages: react-native-cli: 2.0.1

Steps to Reproduce

Using the latest code from Master branch, I tried to add one event using below code

RNCalendarEvents.authorizationStatus().then((status)=>{
      console.log('status',status)
      if(status == 'authorized'){
        RNCalendarEvents.saveEvent('Today evevnt', {
          startDate:new Date('2019-08-07T16:00:00.0000z'),
          endDate: new Date('2019-08-07T17:00:00.0000z')
        }).then((data)=>{
          console.log("data",data)
        })
      }
    })

Its added successfully in Calendar, But when i open the calendar its disappear in few seconds

Expected Behavior

Event should be there always until we delete

Actual Behavior

Its disappear immediately when we open the calendar.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:5

github_iconTop GitHub Comments

18reactions
adamrhuntercommented, Aug 27, 2019

Hi @jitendra8288 -

I had the same problem with Android - (iOS worked fine).

The following fixed my problem:

Find the ‘primary’ calendar and ensure it allows modifications, then save to that specific calendar id

    RNCalendarEvents.findCalendars()
      .then((calendars) => {
        const calendar = calendars.find(cal => (cal.allowsModifications && cal.isPrimary));
        if (!calendar) {
          return;
        }
        RNCalendarEvents.saveEvent('Event Title', {
          startDate: '2019-08-28T16:00:00.0000Z',
          endDate: '2019-08-28T17:00:00.0000Z',
          calendarId: calendar.id,
        },
        { sync: true })
          .then(() => {
            console.log('saved');
          });
      });
2reactions
vinay340commented, Aug 26, 2019

Hi @jitendra8288 , Issue got resolved by changing the date format(i.e, toIsoString()).

It helps your issue.

Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

If a shared calendar is removed, events may get deleted on ...
If a shared calendar is removed, events may get deleted on the owner's calendar. In REST calendars, when you remove a shared or...
Read more >
What to do when Google calendar events disappear
Here's how you can restore Google Calendar events that have disappeared from your Google Calendar on Android and iOS so that you never...
Read more >
Apple Calendar Can't Save Event to Exchange - Fix
In this post, I'll explain how to fix the pesky Calendar can't save event X to Exchange Server issue with Apple's Calendar in...
Read more >
Use keyboard shortcuts in Google Calendar
Shortcuts you can use ; See an event's details. e ; Delete an event. Backspace or Delete ; Undo. z ; Save event...
Read more >
Delete or hide a calendar event on iCloud.com - Apple Support
in the bottom-left corner, then choose Preferences. In the Advanced pane, select “Hide events n-days after theyʼve passed,” then enter the number of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found