Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
extension NSDate {
func isGreaterThanDate(dateToCompare : NSDate) -> Bool {
return self.compare(dateToCompare) == NSComparisonResult.OrderedDescending
}
func isLessThanDate(dateToCompare : NSDate) -> Bool {
return self.compare(dateToCompare) == NSComparisonResult.OrderedAscending
}
func addDays(daysToAdd : Int) -> NSDate
{
let secondsInDays : NSTimeInterval = Double(daysToAdd) * 60 * 60 * 24
return self.dateByAddingTimeInterval(secondsInDays)
}
func addHours(hoursToAdd : Int) -> NSDate
{
let secondsInHours : NSTimeInterval = Double(hoursToAdd) * 60 * 60
return self.dateByAddingTimeInterval(secondsInHours)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment