Following code shows the problem: Advancing a full year from the first day of the year 1435 does not result in the first day of 1436.
Any ideas what i'm missing?
NSDateComponents *components = [[NSDateComponents alloc] init];
[components setDay:1];
[components setMonth:1];
[components setYear:1435];
NSCalendar *islamic = [[NSCalendar alloc] initWithCalendarIdentifier:NSIslamicCalendar];
NSDate *date = [islamic dateFromComponents:components];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setCalendar:islamic];
[dateFormatter setTimeStyle:NSDateFormatterNoStyle];
[dateFormatter setDateStyle:NSDateFormatterMediumStyle];
NSLog(@"%@", [dateFormatter stringFromDate:date]); // -> 01.01.1435
NSDateComponents *offsetComponents = [[NSDateComponents alloc] init];
[offsetComponents setYear:1];
NSDate *dateWithOffset = [islamic dateByAddingComponents:offsetComponents toDate:date options:0];
NSLog(@"%@", [dateFormatter stringFromDate:dateWithOffset]);
// -> 30.12.1435 ... WHY NOT 01.01.1436 ????