-[NSDateFormatter dateFromString:] does not work in 24hr time

Originator:mikeg
Number:rdar://16212028 Date Originated:03-Mar-2014 01:39 PM
Status:Open Resolved:
Product:iOS SDK Product Version:iOS 7.0.6
Classification:Other Bug Reproducible:Always
 
Summary:
-[NSDateFormatter dateFromString:] returns nil when an iPhone is set to 24hr time. The same code works in 12hr time, and -[NSDateFormatter getObjectValue:forString:range:error:] works as expected in both cases.

Steps to Reproduce:
1. Set your device to 24 hr time (Settings, General, Date & Time, set 24-Hour Time to ON).
2. Build and run the linked sample project on the device.

Expected Results:
The app should not break, and the console log should display the values of both variables.

Actual Results:
The app breaks on line 39: "NSAssert(dateFromString, @"Value returned from -dateFromString should not be nil");"

Regression:
Turning the 24-Hour Time switch OFF will cause the app to run successfully.

Notes:
Link to sample project: https://dl.dropboxusercontent.com/u/360389/DateFromStringTest.zip (41kb)

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!