You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
useEffect(() => {
async function init() {
let permission = await RNCalendarEvents.checkPermissions();
let permissionGranted = await RNCalendarEvents.requestPermissions();
if (permissionGranted) {
let calendars = await RNCalendarEvents.findCalendars();
let calendarID = calendars[0].id;
let currentTime = new Date();
let currentTimeMS = currentTime.getTime();
let startTimeMS = currentTimeMS + 240000; // Two Minutes in Future
let startDate = new Date(startTimeMS);
let alarmTimeMS = startTimeMS - 60000; // One Minute Prior to Start
let alarmDate = new Date(alarmTimeMS);
console.log(`Start Time: ${startDate.toISOString()}`);
console.log(`End Time: ${startDate.toISOString()}`);
console.log(`Snooze Time: ${alarmDate.toISOString()}`);
try {
let event = await RNCalendarEvents.saveEvent('Snooze CMS', {
id: '1',
calendarId: calendarID,
startDate: startDate.toISOString(),
endDate: startDate.toISOString(),
alarms: [
{
date: alarmDate.toISOString(),
},
],
});
console.log(event);
} catch (e) {
console.log(e);
}
await RNCalendarEvents.saveEvent('Snooze CMS', {
id: '2',
calendarId: '2',
startDate: startDate.toISOString(),
endDate: startDate.toISOString(),
alarms: [
{
date: alarmDate.toISOString(),
},
],
});
await RNCalendarEvents.saveEvent('Snooze CMS', {
id: '3',
calendarId: '3',
startDate: startDate.toISOString(),
endDate: startDate.toISOString(),
alarms: [
{
date: alarmDate.toISOString(),
},
],
});
await RNCalendarEvents.saveEvent('Snooze CMS', {
id: '4',
calendarId: '4',
startDate: startDate.toISOString(),
endDate: startDate.toISOString(),
alarms: [
{
date: alarmDate.toISOString(),
},
],
});
}
}
init();
setSamples(apiPlaceholder);
}, []);
Expected Behavior
Using different calendarIds results in the event being saved to the respective calendar. When the event is saved, an alert is set for one minute prior to the end date.
Actual Behavior
All events are saved to the holiday calendar and no alert is set.
Result from await RNCalendarEvents.findCalendars();
Each time I attempt to save an event to a calendar on the android device, the event is saved to the holiday calendar and no alarm is added.
Environment
Steps to Reproduce
Expected Behavior
Using different calendarIds results in the event being saved to the respective calendar. When the event is saved, an alert is set for one minute prior to the end date.
Actual Behavior
All events are saved to the holiday calendar and no alert is set.
Result from await RNCalendarEvents.findCalendars();
Result in Calendar View:
The text was updated successfully, but these errors were encountered: