commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Naoya Sugioka <>
Subject [lang] DurationFormatUtils formatPeriod
Date Mon, 13 Aug 2012 20:31:43 GMT

I just encountered an issue with DurationFormatUtils.formatPeriod()
and here I suggest the patch.

The problem is found when calcurating a duration between  June 30 to August 8.

Duration must be 1 month and 9 days  (June 30 + 1 month = July 30,
July 30 + 9 Days = August 8)
but current logic tells this duration is 1 month and 8 days.

then I found out the logic to adjust days value if it was negative by
initial estimate. it uses start date
(June in above case) but must use prev month of end date (July in
above case). then days value was
wrong since getActualMaximum() will return a wrong number.

thank you,

View raw message