๐ ๅ่๏ผSwift Playgrounds (Date Planner - Event Data)
extension Date { // Date.roundedHoursFromNow(hours) static func roundedHoursFromNow(_ hours: Double) -> Date { let exactDate = Date(timeIntervalSinceNow: hours) guard let hourRange = Calendar.current.dateInterval(of: .hour, for: exactDate) else { return exactDate } return hourRange.end } }
Last updated 2 years ago