NSQuarterCalendarUnit does not work

Originator:victor.jalencas
Number:rdar://9270112 Date Originated:2011-04-12
Status:Open Resolved:
Product:iPhone SDK Product Version:4.2
Classification:Other bug Reproducible:Always
 
Summary:
The NSCalendar class accepts a components parameter to decide how to decompose a date into different units. NSQuarterCalendarUnit is one such option, but it is ignored

Steps to Reproduce:
Just run this sample code in a Foundation command line program:

#import <Foundation/Foundation.h>
 
int main (int argc, const char * argv[]) {
  NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
 
  NSCalendar *calendar = [NSCalendar currentCalendar];
  NSLog(@"Quarter: %d", [[calendar components:NSQuarterCalendarUnit fromDate:[NSDate date]] quarter]);
 
  [pool drain];
  return 0;
}

Expected Results: A value from 1 to 4, depending on the current date

Actual Results: 0

Regression: Problem happens both on iOS as well as on MacOS X

Notes:

Comments

Still not fixed as of 10.9.2

I filed a radar with apple (rdar://16341277), open radar tracking link is http://openradar.appspot.com/radar?id=5843373067862016

Seems like someone defined the API, created the constants, but the functionality was never implemented.

Same issue here!

Hi guys. Losing my mind here. Same issue. I cannot use NSQuarterCalendarUnit and this is extremely frustrating. Many hours thrown in the bin.

By betocollin at Aug. 12, 2012, 11:17 p.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!