title: UIDatePicker set Maximum date
body: <p>I am using this code to block the user from going over the limit I set:</p>
  
  <p>in view did load:</p>
  
  <pre><code>NSDate *Date=[NSDate date];
  [DatePickerForDate setMinimumDate:Date];
  [DatePickerForDate setMaximumDate:[Date dateByAddingTimeInterval: 63072000]]; //time interval in seconds
  </code></pre>
  
  <p>And this method:</p>
  
  <pre><code>- (IBAction)datePickerChanged:(id)sender{
  if ( [DatePickerForDate.date timeIntervalSinceNow ] &lt; 0 ){
      NSDate *Date=[NSDate date];
      DatePickerForDate.date = Date;
  }
  
  if ( [DatePickerForDate.date timeIntervalSinceNow ] &gt; 63072000){
      NSDate *Date=[NSDate date];
      DatePickerForDate.date = Date;
  }
  }
  </code></pre>
  
  <p>The first part works (the one with &lt;0), and returns to the current date, but the one > 63072000, sometimes works and sometimes doesn't. By the way 63072000 is about 2 years. Any ideas?</p>