>我正在将"2017-11-24T05:27:00.000Z"中的日期传递给addToCalendar
。在iOS上它工作正常,但Android给出了上述错误。
var start_date = "2017-11-24T05:27:00.000Z";
var end_date = "2017-11-27T05:27:00.000Z"
const eventConfig = {title:'Event name', location:'Satara', notes:'Added event', startDate: start_date, endDate: end_date};
addCalendarEvent(eventConfig) {
AddCalendarEvent.presentNewCalendarEventDialog(eventConfig)
.then(eventId => {
// handle success (receives event id) or dismissing the modal (receives false)
if (eventId) {
alert('Event Created');
} else {
console.warn('dismissed');
}
})
.catch((error: string) => {
// handle error such as when user rejected permissions
console.warn(error);
});
}
我猜你正在使用模块react-native-add-calendar-event
.
检查您使用的是哪个版本,因为我可以看到此问题最近已修复。