garydgregory commented on code in PR #1062: URL: https://github.com/apache/commons-lang/pull/1062#discussion_r1284618041
########## src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java: ########## @@ -50,12 +50,27 @@ * A token character can be repeated to ensure that the field occupies a certain minimum * size. Values will be left-padded with 0 unless padding is disabled in the method invocation. * <br> - * Tokens can be marked as optional by surrounding them with brackets [ ]. These tokens will - * only be printed if the token value is non-zero. Any literals within optional blocks will only be - * printed if the nearest prior non-literal token value was non-zero. + * Tokens can be marked as optional by surrounding them with brackets [ ]. These tokens will + * only be printed if the token value is non-zero. Literals within optional blocks will only be + * printed if the preceding non-literal token is non-zero. Leading optional literals will only + * be printed if the following non-literal is non-zero. + * Multiple optional blocks can be used to group literals with the desired token. Note that + * multiple optional tokens without literals can result in impossible to understand output. + * (See examples below) * <br> + * <table border="1"> + * <caption>Example Output</caption> + * <tr><th>pattern</th><th>Duration.ofDays(1)</th><th>Duration.ofHours(1)</th><th>Duration.ofMinutes(1)</th></tr> Review Comment: > Agree. Added a column for Duration.ofMillis(0) so that empty string results are noticeable, as well as a specific Note. Is the 0 important or the Millis part? It might be more obvious to refer to Duration.ZERO. -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
