NSISO8601DateFormatWithInternetDateTime does not fully implement RFC 3339

Originator:douglashill
Number:rdar://29609526 Date Originated:10-Dec-2016 03:34 PM
Status:Open Resolved:
Product:iOS SDK Product Version:
Classification: Reproducible:
 
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 Mac with 10.12.1 or a device with iOS 10, 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:
iOS 10.1.1, Mac 10.12.1

Notes:
RFC 3339:

https://www.ietf.org/rfc/rfc3339

NSISO8601DateFormatWithInternetDateTime documentation:

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

Related bug report:

http://www.openradar.me/28425750

Configuration:
iOS Simulator and MacBook Air

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!