Unjustified leap-year-only results from -[NSCalendar nextDateAfterDate:...] methods

Number:rdar://36319505 Date Originated:Jan 5, 2018
Status:Open Resolved:NO
Product:iOS Product Version:11.2
Classification:Serious Bug Reproducible:YES

Some dates returned by -[NSCalendar nextDateAfterDate:...] methods are incorrectly skipping ahead to leap years in iOS 11.2. The same methods called in iOS 11.1 when using NSCalendarMatchStrictly return the expected values. All results using NSCalendarMatchNextTime seem to be incorrect.

Steps to Reproduce:
Call one of the -[NSCalendar nextDateAfterDate:...] methods with a start date in February 2018 that looks for the next matching date with a day component less than the start date.

Expected Results:
A day in March 2018.

Actual Results:
A day in February 2020. The enumerated method returns dates in 2020, 2024, 2028, etc.

iOS 11.2


*Xcode project file attachment


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!