I'm trying to filter Realm objects to find those with createdAt dates less than year ago:
let datex = NSCalendar.currentCalendar().startOfDayForDate(NSDate()).dateByAddingTimeInterval(-1*365*24*60*60)
let list = RealmDB.objects(TaskList).filter("createdAt <= '\(datex)'")
I'm getting the following error:
Expected object of type date for property 'createdAt' on object of type 'TaskList', but received: '2015-03-19 21:00:00 +0000'
How do I fix this? It also looks like the date and time value are adjusted to time zone. How can I make sure the date is really the end of the day?