nextTime

If there is no matching time before the end of the next instance of the next higher component to the highest specified component in the DateComponents argument, the algorithm will return the next existing time which exists.

iOS
8.0+
macOS
10.10+
tvOS
9.0+
watchOS
2.0+
case nextTime

For example, during a daylight saving transition there may be no 2:37am. The result would then be 3:00am, if that does exist.

Other cases

  • case nextTimePreservingSmallerComponents

    If specified, and there is no matching time before the end of the next instance of the next higher component to the highest specified component in the DateComponents argument, the method will return the next existing value of the missing component and preserves the lower components’ values (e.g., no 2:37am results in 3:37am, if that exists).

  • case previousTimePreservingSmallerComponents

    If there is no matching time before the end of the next instance of the next higher component to the highest specified component in the DateComponents argument, the algorithm will return the previous existing value of the missing component and preserves the lower components’ values.

  • case strict

    If specified, the algorithm travels as far forward or backward as necessary looking for a match.