In a swift playground, I have been using
NSDate.date()
But, this always appears with the time element appended. For my app I need to ignor
Swift iOS 8 and up When you need more than simply bigger or smaller date comparisons. For example is it the same day or the previous day,...
extension Date {
func compareTo(date: Date, toGranularity: Calendar.Component ) -> ComparisonResult {
var cal = Calendar.current
cal.timeZone = TimeZone(identifier: "Europe/Paris")!
return cal.compare(self, to: date, toGranularity: toGranularity)
}
}
For examples how to use this in a filter see this answer:
https://stackoverflow.com/a/45746206/4946476