I am creating a NSDate. Why the day is always one less?

This is the code:

```
NSDate *today = [NSDate date];
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
    NSDateComponents *comps = [gregorian components:NSCalendarUnitDay | NSCalendarUnitMonth | NSCalendarUnitYear fromDate:today];
[comps setDay:31];
NSDate *lastDayOfMonth = [gregorian dateFromComponents:comps];
NSLog(@"last %@",lastDayOfMonth);

```

this is the log:

```
last 2013-12-30 23:00:00 +0000

```

the result is 30 instead of 31