Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sandin
committed
Sep 23, 2020
1 parent
a8fdf84
commit 18f950d
Showing
15 changed files
with
56 additions
and
34 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
import UIKit | ||
|
||
public extension Date { | ||
|
||
var isDateYesterday: Bool { | ||
Calendar.current.isDateInYesterday(self) | ||
} | ||
|
||
var isDateToday: Bool { | ||
return Calendar.current.isDateInToday(self) | ||
} | ||
|
||
var isDateWeekend: Bool { | ||
Calendar.current.isDateInWeekend(self) | ||
} | ||
|
||
var isDateTomorrow: Bool { | ||
return Calendar.current.isDateInTomorrow(self) | ||
} | ||
|
||
func isDateThisWeek(with date: Date) -> Bool { | ||
return Calendar.current.isDate(date, equalTo: self, toGranularity: .weekday) | ||
} | ||
|
||
func isDateThisMonth(with date: Date) -> Bool { | ||
return Calendar.current.isDate(date, equalTo: self, toGranularity: .month) | ||
} | ||
|
||
func isDateThisYear(with date: Date) -> Bool { | ||
return Calendar.current.isDate(date, equalTo: self, toGranularity: .year) | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters