There are many issues similar to mine, but something goes wrong. Why function setDay sets to 1 day less? Where did I go wrong?
NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
NSDate *today = [NSDate date];
NSLog(@"today date = %@", today);
NSDateComponents *components = [calendar components:(NSCalendarUnitDay | NSCalendarUnitMonth | NSCalendarUnitYear ) fromDate:today];
[components setDay:1];
NSLog(@"modified date = %@", [calendar dateFromComponents:components]);
Log:
today date = 2016-07-04 10:01:30 +0000
modified date = 2016-06-30 21:00:00 +0000
Modified date should be 2016-07-01