I think you're better off writing a custom Date compare function, and 
customising the NSPredicateEditor to return a predicate using the function, so 
that you can guarantee that date comparison happens the way you want. I guess 
you *could* control the date passed into the predicate to normalise the date to 
midday or something, but then if you later added some predicate terms that used 
the time, that wouldn't work, do it would be a bit of a kludge.


--- On Sun, 7/12/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

> From: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
> Subject: Re: NSPredicateEditor and date comparisons
> To: cocoa-dev@lists.apple.com
> Received: Sunday, 7 December, 2008, 6:16 PM
> I remember, way long ago in the past, having to supply a
> time component to go with a date component - otherwise some
> seemingly "random" time was inserted which then
> threw off anything else I did.  If I only needed a date
> (from a datetime field), I had to format it that way (as
> only a date, and in the format I needed) and do some
> seemingly-odd comparison (like comparing two strings).  It
> worked, so I didn't care past that point.
> 
> Quoting Chris Idou <[EMAIL PROTECTED]>:
> 
> > 
> > Would your time zone happen to somehow correspond to
> 8:00 ?
> > 
> > Try doing a setDateValue on the gui component before
> you start, with  a particular time. I've got a suspicion
> that it will then leave the  time component alone. When you
> got a result of 13:41:40, might that  have been the time you
> ran the program?
> > 
> > 
> > --- On Sun, 7/12/08, Josh Abernathy
> <[EMAIL PROTECTED]> wrote:
> > 
> >> From: Josh Abernathy <[EMAIL PROTECTED]>
> >> Subject: Re: NSPredicateEditor and date
> comparisons
> >> To: [EMAIL PROTECTED]
> >> Cc: "Cocoa-Dev List"
> <cocoa-dev@lists.apple.com>
> >> Received: Sunday, 7 December, 2008, 5:00 PM
> >> Ah, yes, that would be the more accurate way to
> explain it.
> >> I have an NSDatePicker in my NSPredicateEditor and
> no funny
> >> business is going on with conversions. It's
> just the
> >> simple default, setup-in-IB usage.
> >> 
> >> So I guess the question is better put: is there
> any
> >> guarantee about the time of an NSDatePicker in an
> >> NSPredicateEditor?
> >> 
> >> I created a quick test of an NSDatePicker outside
> an
> >> NSPredicateEditor and its default time seems to be
> 8:00:00.
> >> 
> >> On Dec 7, 2008, at 5:57 PM, Chris Idou wrote:
> >> 
> >> >
> >> > I'm a bit confused by your post.
> NSPredicateEditor
> >> doesn't compare any dates, it just creates
> NSPredicates.
> >> Maybe you're saying that if you have a
> NSDatePicker in
> >> your NSPredicateEditor, that it creates a
> predicate with a
> >> date set to 13:41:40. If that's the case, then
> it
> >> probably has more to do with the NSDatePicker than
> >> predicates. Unless you're converting the
> predicate to a
> >> string, which introduces more complications.
> >> NSPredicateEditor tends to just call objectValue
> on the gui
> >> component, so try calling that yourself on your
> NSDatePicker
> >> and see what happens.
> >> >
> >> > --- On Sun, 7/12/08, Josh Abernathy
> >> <[EMAIL PROTECTED]> wrote:
> >> >
> >> >> From: Josh Abernathy
> <[EMAIL PROTECTED]>
> >> >> Subject: NSPredicateEditor and date
> comparisons
> >> >> To: "Cocoa-Dev List"
> >> <cocoa-dev@lists.apple.com>
> >> >> Received: Sunday, 7 December, 2008, 11:14
> AM
> >> >> Hi all,
> >> >>
> >> >> In my application, users have the option
> of
> >> comparing to a
> >> >> date in an NSPredicateEditor. For the
> NSDates it
> >> is
> >> >> comparing against, only the date is
> important;
> >> time
> >> >> doesn't matter.
> >> >>
> >> >> The interesting thing I found about
> >> NSPredicateEditor is
> >> >> the NSTimeInterval it compares my NSDates
> to has
> >> the time
> >> >> set to 13:41:40.  That means my NSDates
> with the
> >> default
> >> >> 12:00:00 time don't match an
> "is"
> >> predicate.
> >> >> It's not a big deal because I can
> just change
> >> my
> >> >> NSDate's time to 13:41:40 to fix the
> problem.
> >> >>
> >> >> But what I'm wondering is if this is
> >> guaranteed to
> >> >> always be true. I couldn't find it
> anywhere in
> >> the
> >> >> documentation.
> >> >>
> >> >> Thanks,
> >> >> Josh
> >> >>
> _______________________________________________
> >> >>
> >> >> Cocoa-dev mailing list
> (Cocoa-dev@lists.apple.com)
> >> >>
> >> >> Please do not post admin requests or
> moderator
> >> comments to
> >> >> the list.
> >> >> Contact the moderators at
> >> >> cocoa-dev-admins(at)lists.apple.com
> >> >>
> >> >> Help/Unsubscribe/Update your
> Subscription:
> >> >>
> >>
> http://lists.apple.com/mailman/options/cocoa-dev/idou747%40yahoo.com
> >> >>
> >> >> This email sent to [EMAIL PROTECTED]
> >> >
> >> >
> >> >      Start your day with Yahoo!7 and win a
> Sony Bravia
> >> TV. Enter now
> >>
> http://au.docs.yahoo.com/homepageset/?p1=other&p2=au&p3=tagline
> > 
> > 
> >       Start your day with Yahoo!7 and win a Sony
> Bravia TV. Enter  now
> http://au.docs.yahoo.com/homepageset/?p1=other&p2=au&p3=tagline
> > _______________________________________________
> > 
> > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> > 
> > Please do not post admin requests or moderator
> comments to the list.
> > Contact the moderators at
> cocoa-dev-admins(at)lists.apple.com
> > 
> > Help/Unsubscribe/Update your Subscription:
> >
> http://lists.apple.com/mailman/options/cocoa-dev/jmunson%40his.com
> > 
> > This email sent to [EMAIL PROTECTED]
> > 
> 
> 
> 
> _______________________________________________
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to
> the list.
> Contact the moderators at
> cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/idou747%40yahoo.com
> 
> This email sent to [EMAIL PROTECTED]


      Start your day with Yahoo!7 and win a Sony Bravia TV. Enter now 
http://au.docs.yahoo.com/homepageset/?p1=other&p2=au&p3=tagline
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to