mattt/FormatterKit — pull request #51 by defragged (2013-06-05 16:48:11+00:00)
Title: TTTTimeIntervalFormatter: Specifying Precision

Hello,

In a project I'm working on, I found it useful to be able to specify how many units of precision are shown. If you feel this would be useful functionality for the library, feel free to merge this pull request.

This adds two properties to `TTTTimeIntervalFormatter`: `numberOfSignificantUnitsToDisplay` and `leastSignificantUnitToShow`. Their defaults (`1` and `NSSecondCalendarUnit`) keeps the current functionality, so this change should maintain backwards compatibility.

For example: I'm showing the duration of an event. If I wanted to see (at most) 2 units, but was never interested in seeing seconds, I could specify `numberOfSignificantUnitsToDisplay` as `2`, and `leastSignificantUnitToShow` as `NSMinuteCalendarUnit`. If I specify 90 minutes with these settings, `1 hour 30 minutes` (along with the deictic expressions etc) is returned.

Let me know if anything isn't clear, or there's any changes you'd like me to make.

Thanks.