title: when grouping by date, wrong dates are shown
body: <p>I have a struct like so: </p>
  
  <pre><code>struct myStruct {
      let date: Date
      let details: [Detail]
  }
  </code></pre>
  
  <p>I have an array of <code>myStruct</code></p>
  
  <p>Basically I would like to group them by the date, but the problem I'm having with the way im doing it is that it isnt accurate when grouping the dates. </p>
  
  <p>for example I have a date from the 23rd of June. But in its becoming the 22nd. </p>
  
  <p>Could it be when decoding its incorrect? </p>
  
  <p>Here's how I decode it: </p>
  
  <pre><code>let dateFormatter = DateFormatter()
  dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"
  
  let decoder = JSONDecoder()
  decoder.dateDecodingStrategy = .formatted(dateFormatter)
  </code></pre>
  
  <p>Then to group it: </p>
  
  <pre><code>let cal = Calendar.current
  let grouped = Dictionary(grouping: results, by: { cal.startOfDay(for: $0.date) })
  
  let sortedKeys = grouped.keys.sorted { $1 &lt; $0 }
  let data = sortedKeys.map { key in
  return DateSection(date: key, details: grouped[key]!)
  }
  </code></pre>
  
  <p>backend stored date : <code>2018-06-23T03:57:47.349Z UTC</code> </p>
  
  <p>after decoding,  sorting and grouping date becomes <code>June 22, 2018</code></p>