I was working on expo calendar recently. I came across a problem that on ANDROID, whenever I create a new calendar event and change the timeZone of the device, then the event is removed from the calendar.
Here are my configurations:
For calendar:
const newCalendar = {
title: 'Test',
entityType: Calendar.EntityTypes.EVENT,
color: 'red',
sourceId:
Platform.OS === 'ios' &&
calendars.find(
cal =>
(cal.source && cal.source.name === CALENDAR_SOURCE_IOS.DEFAULT) ||
(cal.source && cal.source.name === CALENDAR_SOURCE_IOS.I_CLOUD)
).source.id,
source: Platform.OS === 'android' && {
name: calendars.find(cal => cal.accessLevel === Calendar.CalendarAccessLevel.OWNER).source
.name,
isLocalAccount: true,
},
name: 'Test',
accessLevel: Calendar.CalendarAccessLevel.OWNER,
ownerAccount:
Platform.OS === 'android' &&
calendars.find(cal => cal.accessLevel === Calendar.CalendarAccessLevel.OWNER).ownerAccount,Calendar.CalendarAccessLevel.OWNER).ownerAccount,
allowsModifications: false,
isVisible: true,
}
For Event:
const event = {
title: 'test event',
startDate: testStartDate,
endDate: testEndDate,
location: 'Test location',
timeZone: Localization.timezone,
endTimeZone: Localization.timezone,
}
The behavior on iOS on changing the timezone is: the event date is updated in calendar. (which is the expected behavior).
On Android: On changing the timezone of the device, the event is removed.