Error: No start date has been set.
See original GitHub issueVersion:
React-native-calendar-events: 1.7.3
React-native: 0.59.9
Running on iOS 13.1.3
Example code used:
RNCalendarEvents.authorizeEventStore().then(() => {
const notes = `This is the notes`;
const calendareObject = {
startDate: new Date(slotDateTimeInUnix),
endDate: new Date(slotEndDateTimeInUnix),
alarms: [{ date: -60 }]
}
if(Platform.OS === 'ios') {
calendareObject.notes = notes;
} else {
calendareObject.description = notes;
}
RNCalendarEvents.saveEvent(`AppointmentName`, calendareObject)
.then(response => {
Alert.alert(`Saved to calendar with response: ${response}`)
}).catch(error => {
Alert.alert(error) // line catching the error
});
}).catch(error => ErrorHandler.handleError(error));
The issue:
Saving events have worked in all environments for the longest, but lately it has mysteriously stopped working on iOS devices. When saving an event on iOS simulator, everything is saved as expected.
The error presented in the app installed on a device via TestFlight is:
Error: No start date has been set…
When alerting the startDate before trying to save the event it’s there and in the correct format, the same format as on the simulator. Seemingly the object being saved is the same on both the simulator and in TestFlight, but with the error being returned from the TestFlight version.
I have NSCalendarsUsageDescription set in info.plist.
Any suggestions or ideas?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (1 by maintainers)
Top GitHub Comments
Please set the Date to ISO Format.
Figured it out. The start date must include microseconds:
2020-11-01T19:00:00.000Z
That’s not ISO. Sorry @wmcmahan you should check what ISO format is actually defined as.