Weird behavior when creating an NSDate of January the 1st and the 2nd
问题 I'm creating a date like this : NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@"YYYY"]; NSInteger year = [[dateFormatter stringFromDate:[NSDate date]] intValue]; NSLog(@"NSInteger YEAR : %d\n", year); //minutes, hours, day and month are initialized elsewhere... NSDateComponents *comps = [[NSDateComponents alloc] init]; [comps setYear:year]; [comps