title: Core Data - Predicates with NSDates
body: <p>Hallo,</p>
  
  <p>I am working on a Core Data app and have to do some filtering based on dates.  I've run some testing and it appears that when comparing NSDates, Core Data is comparing the <em>time</em> component of the dates as well.</p>
  
  <p>My code:</p>
  
  <pre><code>- (BOOL)hasSpeakersWithinDateRangeFrom:(NSDate *)startOfRange through:(NSDate *)endOfRange {
      NSPredicate* dateRangePredicate = [NSPredicate predicateWithFormat:@"startOn &lt;= %@ &amp;&amp; endOn &gt;= %@", startOfRange, endOfRange];
      NSSet* speakersWithinDateRange = [self.speakers filteredSetUsingPredicate:dateRangePredicate];
  
      if ([speakersWithinDateRange count] &gt; 0)
          return YES;
      else
          return NO;
  }
  </code></pre>
  
  <p>and I have a "convenience" method that is a one-line'er:</p>
  
  <pre><code>- (BOOL)hasSpeakersNow {
      return [self hasSpeakersWithinDateRangeFrom:[NSDate date] through:[NSDate date]];
  }
  </code></pre>
  
  <p>When I run some basic testing, it doesn't work as planned, and from what I can tell Core Data is comparing the time components of the NSDate objects along with the dates.</p>
  
  <p>So, how can I rewrite the above to ignore time and only be sensitive to the day passed?</p>
  
  <p>Thank you</p>