title: Swift rounding down Date seconds to zero
body: <p>I have a bunch of <code>Date</code> objects that I want to perform calculations on, for these calculations I dont need second precision so I am attempting to "zero out" the seconds on my <code>Date</code>s.  This all works fine unless the <code>Date</code> already has zero seconds in which case Swift decrements the number of minutes by one, e.g 10:30:00 -> 10:29:00.  </p>
  
  <p>My code:</p>
  
  <pre><code>let calendar = Calendar.current
  var minuteComponent = DateComponents()
  minuteComponent.second = 0
  
  let dateDelta = calendar.nextDate(after: date, matching: minuteComponent, matchingPolicy: .nextTime, direction: .backward)
  </code></pre>
  
  <p>I have tried all the matching policies only to get the same result.</p>
  
  <p>This seems odd to me, as the target is already at the required value, though I suspect it is inline with the documentation.</p>
  
  <p>Is this an appropriate way to zero out the seconds while preserving  the higher magnitude components or is there a better way?</p>