• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSArrayController filterPredicate and dates
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSArrayController filterPredicate and dates


  • Subject: Re: NSArrayController filterPredicate and dates
  • From: mmalcolm crawford <email@hidden>
  • Date: Wed, 10 May 2006 20:09:53 -0700


On May 10, 2006, at 4:56 PM, Ken Victor wrote:

i've got a table view that uses an array controller bound to one of the entities in my core data model. in response to user actions, i set the filterPredicate of the array controller. and all is good... most of the time!
the problem occurs if i use a predicate of the form:
<date field key> == NSCalendarDate
or <date field key> != NSCalendarDate


Core Data dates are stored as NSDate objects:
<http://developer.apple.com/documentation/Cocoa/Reference/ CoreData_ObjC/Classes/NSAttributeDescription.html#//apple_ref/doc/ c_ref/NSDateAttributeType>


if instead of comparing for (in)equality, i compare <. <=, >, or >= all works as expected. i believe this indicates that i am building the predicate properly.
if i look at my built predicate with the debugger, i see what i would expect to see:
startDate == CAST(168993946.767526, "NSDate")
where the float inside the cast corresponds to the user specified date. and when i look at my accessor method for startDate, it returns the expected value (as an NSCalendarDate).


Are any date attribute values *exactly* the same as the value you're comparing with, down to the final decimal place?

mmalc

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >NSArrayController filterPredicate and dates (From: Ken Victor <email@hidden>)

  • Prev by Date: Re: Cocoa software design issue
  • Next by Date: NSComboBox, observeValueForKeyPath:, and modal dialog
  • Previous by thread: NSArrayController filterPredicate and dates
  • Next by thread: Weird error with structs and @try/@catch
  • Index(es):
    • Date
    • Thread