Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Alarm offset must be positive on Android, but negative on iOS #330

Open
osartun opened this issue Nov 16, 2020 · 3 comments
Open

Bug: Alarm offset must be positive on Android, but negative on iOS #330

osartun opened this issue Nov 16, 2020 · 3 comments

Comments

@osartun
Copy link

osartun commented Nov 16, 2020

When creating a calendar event with alarms the number of minutes must be different between iOS and Android or otherwise on one platform the alarm is before the startDate and on the other it's after the startDate.

iOS Android
On iOS the alarm is after the start date On Android the alarm is before the start date

Also, the number is not allowed to be negative on Android or it might not show the alarms at all.

Environment

System:
    OS: macOS 10.15.7
    CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
    Memory: 350.89 MB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 12.14.1 - /var/folders/hp/wl2yw33n69xf_1lkp8y6gry80000gn/T/yarn--1605546136287-0.33153789553280055/node
    Yarn: 1.22.5 - /var/folders/hp/wl2yw33n69xf_1lkp8y6gry80000gn/T/yarn--1605546136287-0.33153789553280055/yarn
    npm: 6.13.4 - /usr/local/Cellar/nvm/0.33.11/versions/node/v12.14.1/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.7, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
    Android SDK: Not Found
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.5900203
    Xcode: 11.7/11E801a - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.7 - /usr/bin/javac
    Python: 3.6.4 - /Users/oliver/.pyenv/shims/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.11.0 => 16.11.0
    react-native: 0.62.2 => 0.62.2
  npmGlobalPackages:
    *react-native*: Not Found

Steps to Reproduce

Sorry, this is an incomplete code sample.

RNCalendarEvents.saveEvent(title, {
  calendarId,
  description,
  notes: description,
  startDate: startDate.toISOString(),
  endDate: endDate.toISOString(),
  alarms: [{
    date: 30
  }],
});

Expected Behavior

I expect to get the same behavior on both, Android and iOS, when using the same data.

Actual Behavior

I get different results between Android and iOS.

Notes

I suggest to add Math.abs() to the Android code as CalendarContract.Reminders.MINUTES isn't allowed to be a negative value anyway (with the exception of -1).

reminderValues.put(CalendarContract.Reminders.MINUTES, minutes);

@Aggie123
Copy link

Same problem here...

@MoOx
Copy link
Collaborator

MoOx commented Dec 5, 2020

Some people said that they were successfully using negative number.

Anyway, PR is welcome to improve the lib. This will be released as a major release even if that's a minor change because some people so iOS ? 30 : -30.

@gunnartorfis
Copy link

Same thing happening here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants