DateComponentsFormatter maximumUnitCount is not respected for all dates

Originator:aaron
Number:rdar://36674487 Date Originated:1/19/2018
Status:Open Resolved:
Product:iOS + SDK Product Version:iOS 11.2.2
Classification:Other Bug Reproducible:
 
Area:
Calendar

Summary:
When initializing a DateComponentsFormatter with a maximum unit count of 1, dates that have the next unit that should be truncated with a value of 1 sometimes output with two units.

e.g.: "3 minutes 1 second", "6 hours 1 minute", "4 days, 1 hour", etc.

Steps to Reproduce:
Repro case available in attached playground and screenshot.

Expected Results:
When a DateComponentsFormatter has maximumUnitCount set to 1, all output should have only one unit.

Actual Results:
Some outputs have two units.

Version/Build:
iOS 11.2.2

Configuration:

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!