How to create a specific date in the distant past, the BC era.
- by alloy
I’m trying to create a date in the BC era, but failing pretty hard. The following returns ‘4713’ as the year, instead of ‘-4712’:
NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDateComponents *components = [NSDateComponents new];
[components setYear: -4712];
NSDate *date = [calendar dateFromComponents:components];
NSLog(@"%d", [[calendar components:NSYearCalendarUnit fromDate: date] year]);
Any idea what I’m doing wrong?