commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (JIRA)" <>
Subject [jira] [Commented] (LANG-1344) exclude empty parts in DurationFormatUtils
Date Tue, 04 Jul 2017 11:00:01 GMT


Sebb commented on LANG-1344:

Note that there needs to be at least one part, i.e. a zero second duration should print {{0s}}.

What about {{1d 2s}} ?
I think that might look better as {{1d 0h 0m 2s}}.

In other words, maybe the option should be to drop leading empty parts, not all empty parts.

Dropping trailing empty parts may also make sense, but care needs to be taken that this is
not confused with truncation/rounding, so should probably be a separate option.

> exclude empty parts in DurationFormatUtils
> ------------------------------------------
>                 Key: LANG-1344
>                 URL:
>             Project: Commons Lang
>          Issue Type: Improvement
>          Components: lang.time.*
>    Affects Versions: 3.6
>            Reporter: Gregor B. Rosenauer
>            Priority: Minor
> }}DurationFormatUtils only allow to exclude leading or trailing zeroes, but not empty
parts alltogether, e.g. when a position is 0 (0 days or hours).
> This would improve readability and look better in most cases where the duration can vary
between seconds or days and I don't want to special case, e.g. having it print 
> {{2s}} instead of {{0d 0h 00m 02s}}.

This message was sent by Atlassian JIRA

View raw message