0

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 {

  }
Ashish Kakkad
  • 23,586
  • 12
  • 103
  • 136
rajes
  • 251
  • 2
  • 4
  • 8

1 Answers1

1

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
7vikram7
  • 2,764
  • 1
  • 25
  • 43