import Foundation // Calendar
extension Calendar {
// Calendar.current.numberOfDays(between: date1, and: date2)
public func numberOfDays(between date1: Date, and date2: Date) -> Int {
let date1 = startOfDay(for: date1)
let date2 = startOfDay(for: date2)
let components = dateComponents([.day], from: date1, to: date2)
return components.day!
}
}