Hello Laertes, Thank you for your interest in improving Apache Commons Lang :-)
Do you foresee any compatibility issues for existing call sites and format strings? For example, can you make your use cases work and still support: https://github.com/apache/commons-lang/blob/d861f1b2116a41a45949d1401785220119a57e56/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java#L463-L473 Or, should these cases no longer be supported? TY! Gary On Fri, May 24, 2024 at 4:15 PM Laertes Moustakas <lmous...@gmail.com> wrote: > > Greetings, > > org.apache.commons.lang3.time.DurationFormatUtils contains useful methods > to format a duration or period of milliseconds in the textual > representation given by the format argument. It even allows arbitrary text > to be printed between single quotes, on the condition that any opening > single quotes will eventually close with another single quote. > > For example, > DurationFormatUtils.formatDuration(64000L, "mm:ss") > will return "01:04". > > While > DurationFormatUtils.formatDuration(1804000L, "m'min' s'sec'") > will yield "34min 4sec". > > However, as per the JavaDoc page for this class > <https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/time/DurationFormatUtils.html> > including > a single quote is currently not supported. Other classes that format > datetime such as the java.text.SimpleDateFormat do, by putting two single > quotes next to each other. > > So something like > new SimpleDateFormat("mm'' ss'sec'").format(new Date()); // note the two > single quotes after "mm" > will return something like this: > "42' 02sec" > > Instead, > DurationFormatUtils.formatDuration(64000L, "mm'' ss'sec'") > will return "01 04sec". > > I wish to implement support for single quotes in the DurationFormatUtils > format the same way SimpleDateFormat does; by escaping it with two > consecutive single quote characters. I have searched the mailing list and > found no similar request. I have already tested on the copy of a source > code, including adding tests, and no test throughout the commons-lang > project failed. > > Please let me know if this is an acceptable change, and the next steps to > take should this move forward. > > Best regards, > Laertes Moustakas --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org