I notice that when formatting the new
Duration there is an issue when you limit to sub-second units.
let exposure: Duration = .milliseconds(2000) + .milliseconds(12) + .microseconds(923)
.units(allowed: [.seconds, .milliseconds]) // "2 sec, 13 ms" 😀
.units(allowed: [.milliseconds]) // "13 ms" 🤨 Expected: 2,013 ms
.units(allowed: [.milliseconds], valueLength: 4) // "0,013 ms" 🙃
I know that
Duration is split into seconds and atto-seconds under the hood so have a guess why it is happening. Where should I report a bug about this?
Duration is part of Swift and the formatters are part of Foundation?
This looks like issues with formatting, not
Duration itself so probably feedback assistant would be the right spot.
This part is definitely part of the localization/internationalization; my guess is either a) there is a feature in the
.time format style missing that you need or b) you are really trying to express a
Note: this area is not per-se my focus so other folks may have a more nuanced suggestion; never the less as @ktoso suggested submitting feedback would definitely be the route to take here.
Thank you very much. I posted FB12010264 with these two examples:
) // produces expected output "2,042 μs"
) // produces unexpected output "42 ms"
Hope this helps.
Worth trying this one as well:
it might also return "2,042 μs" (I didn't try).
Have you tried the version of "formatted" call that takes "valueLengthLimits" parameter?
@Ray_Fix If you can try this on the current seeds, it appears this has been fixed.