title: NSDate month addition and subtraction
body: <p>I have a class that holds an start date and an end date, normally initialised to the firt and last second of the month.</p>
  
  <p>The following function works correctly going from Nov 2010 forwards into December and back again however going backwards from November ends up with startDate set to</p>
  
  <blockquote>
    <p>2010-09-30 23:00:00 GMT</p>
  </blockquote>
  
  <p>Ie. a month and an hour ago.</p>
  
  <p>Strangely the endDate is still correctly set to </p>
  
  <blockquote>
    <p>2010-11-01 00:00:00 GMT</p>
  </blockquote>
  
  <p>And going forward a month from this incorrect date also results in the correct time and date.</p>
  
  <p>Is this a bug or am I doing something I shouldn't be ?</p>
  
  <pre>
  -(void) moveMonth:(NSInteger)byAmount { // Positive or negative number of months
      NSCalendar *cal = [NSCalendar currentCalendar];
  
   NSDateComponents *components = [[[NSDateComponents alloc] init] autorelease];
   // Update the start date
   [components setMonth:byAmount];
   NSDate *newStartDate = [cal dateByAddingComponents:components toDate:[self startDate] options:0];
   [self setStartDate:newStartDate];
  
   // And the end date
   [components setMonth:1];
   NSDate *newEndDate = [cal dateByAddingComponents:components toDate:[self startDate] options:0 ];
   [self setEndDate:newEndDate];
  }
  </pre>
  
  <p>SOLUTION: Answer correctly pointed out this is a DST issue</p>
  
  <p>If you want to deal in absolute times and date then using the following avoids any DST being involved.</p>
  
  <pre>
      NSCalendar *cal = [[NSCalendar alloc ] initWithCalendarIdentifier:NSGregorianCalendar] autorelease];
      NSTimeZone *zone = [NSTimeZone timeZoneWithName:@"GMT"];
      [cal setTimeZone:zone];
  </pre>