The start date of the task.
SDKs
- iOS 6.0+
- macOS 10.8+
- Mac Catalyst 13.0+
- watchOS 2.0+
Framework
- Event
Kit
Declaration
var startDateComponents: Date Components? { get set }
Discussion
The use of date components allows the start date and its time zone to be represented in a single property. A nil
time zone represents a floating date. Setting a date component without an hour, minute and second component will set the reminder to be an all-day reminder. If this property is set, the calendar must be set to NSGregorian
; otherwise an exception is raised.
The start date components’s time
property corresponds to the time
property on EKCalendar
. A change in one value will cause a change in the other. Setting the time zone directly on the components does not guarantee that your changes will be saved; instead, pull this property from the reminder, set the time zone on it, and assign it back to the reminder:
NSDateComponents *start = myEKReminder.startDateComponents;
start.timeZone = myNSTimeZone;
myEKReminder.startDateComponents = start;