Oyvindkg/swiftydb

chaining filters to find dates within a month..

Closed this issue · 1 comments

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?

Thanks for the heads-up!

I believe this issue is fixed in 1.1.0. Try updating SwiftyDB and see if it helps :)

The SQLiteValue protocol has been renamed to Value with the introduction of storeable collections