Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions Extended/Classes/Date.swift
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,25 @@ extension Date {

return cal.date(from: components)
}

/// Returns true if self is before the given date, false otherwise.
func before(_ date: Date) -> Bool {
return self < date
}

/// Returns true if self is before or equal the given date, false otherwise.
func onOrBefore(_ date: Date) -> Bool {
return self <= date
}

/// Returns true if self is after the given date, false otherwise.
func after(_ date: Date) -> Bool {
return self > date
}

/// Returns true if self is after or equal to the given date, false otherwise.
func onOrAfter(_ date: Date) -> Bool {
return self >= date
}

}