HI, i have hard time migrating this function to swift 3, can someone help me
extension Date {
func numberOfDaysUntilDateTime(toDateTime: NSDate, calendar:NSCalendar) -> Int {
var fromDate: NSDate?, toDate: NSDate?
calendar.rangeOfUnit(.Day, startDate: &fromDate, interval: nil, forDate: self)
calendar.rangeOfUnit(.Day, startDate: &toDate, interval: nil, forDate: toDateTime)
let difference = calendar.components(.Day, fromDate: fromDate!, toDate: toDate!, options: [])
return difference.day
}
}