You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2020/03/29 10:44:06 UTC

[GitHub] [commons-lang] kinow commented on a change in pull request #506: LANG-1530 another method like formatDurationWords with

kinow commented on a change in pull request #506: LANG-1530 another method like formatDurationWords with 
URL: https://github.com/apache/commons-lang/pull/506#discussion_r399778674
 
 

 ##########
 File path: src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java
 ##########
 @@ -171,56 +175,96 @@ public static String formatDuration(final long durationMillis, final String form
      * @throws java.lang.IllegalArgumentException if durationMillis is negative
      */
     public static String formatDurationWords(
-        final long durationMillis,
-        final boolean suppressLeadingZeroElements,
-        final boolean suppressTrailingZeroElements) {
-
-        // This method is generally replaceable by the format method, but
-        // there are a series of tweaks and special cases that require
-        // trickery to replicate.
-        String duration = formatDuration(durationMillis, "d' days 'H' hours 'm' minutes 's' seconds'");
+            final long durationMillis,
+            final boolean suppressLeadingZeroElements,
+            final boolean suppressTrailingZeroElements) {
+        return formatDurationWordsWithMs(durationMillis, false,
+                                         suppressLeadingZeroElements, suppressTrailingZeroElements);
+    }
+
+    /**
+     * <p>Formats an elapsed time into a pluralization correct string.</p>
+     * <p>Returns duration in format '0 days 0 hours 0 minutes 0 seconds 0 milliseconds'</p>
+     * It removes all leading time units with 0 value.
 
 Review comment:
   Dangling text. Was it supposed to be within the previous `<p>`?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services