NSDateComponentsFormatter.allowsFractionalUnits does not work
Originator: | osanoj | ||
Number: | rdar://22660145 | Date Originated: | 11-Sep-2015 03:13 PM |
Status: | Open | Resolved: | |
Product: | iOS SDK | Product Version: | |
Classification: | Other Bug | Reproducible: | Always |
Summary: I can't get the NSDateComponentsFormatter to give me a decimal value. I have tried in Swift and Objective-C and turning on allowsFractionalUnits doesn't seem to do anything. Steps to Reproduce: Swift code: let formatter = NSDateComponentsFormatter() formatter.unitsStyle = .Abbreviated formatter.allowedUnits = .Hour formatter.allowsFractionalUnits = true let onePointFiveHoursInSeconds = NSTimeInterval(1.5 * 60.0 * 60.0) print(formatter.stringFromTimeInterval(onePointFiveHoursInSeconds)!) //"1h" instead of expected "1.5h" Expected Results: "1.5h" printed Actual Results: "1h" printed
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!
Update from Apple in 2019
"Unfortunately, the fix here is nontrivial, and other tasks have taken precedence. This is something we'd still like to resolve, and we’ll be tagging this for a more prioritized fix."
Any news on this bug?