NSDateFormatter parse failure

Originator:bryanmontz
Number:rdar://12029137 Date Originated:03-Aug-2012
Status:Open Resolved:
Product:iPhone SDK Product Version:5.1.1
Classification:Serious Bug Reproducible:Always
 
Summary:

On iOS 5.1.1, NSDateFormatter fails to parse a specific date string.


Steps to Reproduce:

NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
formatter.dateFormat = @"yyyy-MM-dd HH:mm:ss.SSSSSSZZZ";
NSString *dateString = @"2012-03-30 15:45:26.999515-05";
NSDate *date = [formatter dateFromString: dateString];
NSLog(@"date: %@", date);


Expected Results:

date: 2012-03-30 20:45:26 +0000

"dateString" is parsed by the NSDateFormatter, and "date" is not nil.


Actual Results:

date: (null)

"dateString" is not successfully parsed, and "date" is nil.


Regression:

I encountered this bug using Xcode 4.3.3 (4E3002) using the simulator running iOS 5.1 (9B176). I also tried it on an iPhone 3GS running iOS 5.1.1 (9B206) and saw the same issue.

If you change the dateString to @"2012-03-30 15:45:26.899515-05" (a difference of one digit), the date is parsed correctly.

Comments


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!