NSISO8601DateFormatWithInternetDateTime does not fully implement RFC 3339

Originator:egill
Number:rdar://34373879 Date Originated:9-11-2017
Status: Resolved:
Product:iOS Product Version:10.3.2
Classification:UI/Usability Reproducible:Always
 
Area:
Foundation

Summary:
It is stated in the documentation that NSISO8601DateFormatter with the NSISO8601DateFormatWithInternetDateTime will parse dates formatted according to RFC 3339. However, this is not the case as it fails to parse strings with non-integer dates, which is part of RFC 3339.

Steps to Reproduce:
Run the code below on a device with iOS 10 or iOS 11, which tries to parse a date string that is used as an example in RFC 3339 on page 9.

NSISO8601DateFormatter *formatter = [[NSISO8601DateFormatter alloc] init];
formatter.formatOptions = NSISO8601DateFormatWithInternetDateTime;
NSLog(@"%@", [formatter dateFromString:@"1985-04-12T23:20:50.52Z"]);

Expected Results:
As RFC 3339 page 9 states, this should be parsed as 20 minutes and 50.52 seconds after the 23rd hour of April 12th, 1985 in UTC.

Actual Results:
dateFromString: returns nil.

Version/Build:
iOS 10.3.2, iOS 11 Beta 10

Notes:
RFC 3339: 
https://www.ietf.org/rfc/rfc3339

NSISO8601DateFormatWithInternetDateTime documentation:
https://developer.apple.com/reference/foundation/nsiso8601dateformatoptions/nsiso8601dateformatwithinternetdatetime?language=objc

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!