chaining filters to find dates within a month..
Closed this issue · 1 comments
galileomd commented
so i've been trying to filter the query to get all dates within the month, but nothing comes up... if i drop one portion of the filter or the other, it gets me more than what i'm looking for:
`
let calendar = NSCalendar(identifier: NSCalendarIdentifierGregorian)
let components = NSDateComponents()
components.year = dayOfMonth.year
components.month = dayOfMonth.month
components.day = 1
let dateFrom = calendar?.dateFromComponents(components)
print("From: (dateFrom)")
components.month = dayOfMonth.month + 1
let dateTo = calendar?.dateFromComponents(components)
print("To: \(dateTo)")
let filter = Filter
.greaterOrEqual("buttonPressedTimestamp", value: dateFrom)
.lessOrEqual("buttonPressedTimestamp", value: dateTo)
let results = database.objectsForType(Event.self, matchingFilter: filter)
`
any suggestions?