What is the best way to properly check if a date is at least tomorrow?
So far I was able to come up with this solution, but I'm not 100% sure it's correct:
let calendar = Calendar.current
func isAtLeastTomorrow(_ date: Date) -> Bool {
let now = Date()
let startOfToday = calendar.startOfDay(for: now)
let startOfTomorrow = calendar.date(byAdding: .day, value: 1, to: startOfToday)!
return startOfTomorrow.timeIntervalSince1970 - date.timeIntervalSince1970 <= 0
}
let someDate = Date(timeIntervalSinceNow: 60 * 60 * 16)
isAtLeastTomorrow(someDate)