seaneagan / intlx

experimental internationalization APIs for Dart
BSD 2-Clause "Simplified" License
8 stars 3 forks source link

Allow formatted durations to contain multiple time units #1

Open seaneagan opened 11 years ago

seaneagan commented 11 years ago

Could allow DurationRounder.roundDuration to return a Map<TimeUnit, int> which could then mapped to a list of formatted Durations, sorted in descending order of TimeUnit, which can then be formatted using a CollectionFormat.

For example:

new Duration(seconds: 19,531) // -> { TimeUnit.HOUR: 5, TimeUnit.MINUTE: 25, TimeUnit.MINUTE: 31 } // -> ["5 hours", "25 minutes", "31 seconds"] // -> "5 hours, 25 minutes, and 31 seconds"

Are there any languages where this doesn't work? Are there any languages where the order should be reversed?