Reputation: 251
I am working on calendar application.
I am trying to add add new event in default iPhone calendar.In this case successfully added event,but start time always set 5.30 PM in default iPhone calendar how to solve this issue
Attached below piece of code,
let event = EKEvent(eventStore: store)
event.title = "calendar Name"
event.startDate = startDate //2016-05-19 00:00:00 +0000
event.endDate = endDate // 2016-05-19 23:59:59 +0000
event.calendar = store.defaultCalendarForNewEvents
do {
try store.saveEvent(event, span: .ThisEvent, commit: true)
} catch {
}
Upvotes: 0
Views: 927
Reputation: 2824
Seems like your device timezone is set to IST.
Hence, 5.30 AM displayed in your device’s calendar is the expected behaviour. Because when saving the start time; you are saving it in GMT; notice the +0000 in the time.
If you want to save the event as an all day event, Simply set
event.allDay = YES
Upvotes: 1