title: Swift 3 Calendar.range - migrate function
body: <p>I am not sure how to migrate this function correctly to swift 3.</p>
  
  <pre><code>extension Date {  
  
      func numberOfDaysUntilDateTime(toDateTime: NSDate, calendar:NSCalendar) -&gt; Int {  
  
          var fromDate: NSDate?, toDate: NSDate?  
  
          calendar.rangeOfUnit(.Day, startDate: &amp;fromDate, interval: nil, forDate: self)  
          calendar.rangeOfUnit(.Day, startDate: &amp;toDate, interval: nil, forDate: toDateTime)  
  
          let difference = calendar.components(.Day, fromDate: fromDate!, toDate: toDate!, options: [])  
  
          return difference.day  
  
      }  
  
  }  
  </code></pre>