Issue Details (XML | Word | Printable)

Key: LANG-346
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Henri Yandell
Reporter: Ken Dombeck
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Commons Lang

Dates.round() behaves incorrectly for minutes and seconds

Created: 06/Jul/07 08:06 PM   Updated: 24/Feb/08 04:24 AM
Return to search
Component/s: None
Affects Version/s: 2.2, 2.3
Fix Version/s: 2.4

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works LANG-346-fix.patch 2007-08-08 09:37 PM Henri Yandell 1 kB
Text File Licensed for inclusion in ASF works LANG-346.patch 2007-08-07 07:04 AM Dave Meikle 4 kB
Issue Links:
Duplicate
 

Resolution Date: 09/Aug/07 12:25 AM


 Description  « Hide
Get unexpected output for rounding by minutes or seconds.

public void testRound()
{
Calendar testCalendar = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
testCalendar.set(2007, 6, 2, 8, 9, 50);
Date date = testCalendar.getTime();
System.out.println("Before round() " + date);
System.out.println("After round() " + DateUtils.round(date, Calendar.MINUTE));
}

--2.1 produces
Before round() Mon Jul 02 03:09:50 CDT 2007
After round() Mon Jul 02 03:10:00 CDT 2007 – this is what I would expect

--2.2 and 2.3 produces
Before round() Mon Jul 02 03:09:50 CDT 2007
After round() Mon Jul 02 03:01:00 CDT 2007 – this appears to be wrong



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Henri Yandell made changes - 06/Jul/07 08:24 PM
Field Original Value New Value
Fix Version/s 2.3.1 [ 12312481 ]
Dave Meikle made changes - 02/Aug/07 07:06 AM
Attachment LANG-346.patch [ 12363025 ]
Dave Meikle made changes - 03/Aug/07 08:58 AM
Attachment LANG-346.patch [ 12363025 ]
Dave Meikle made changes - 03/Aug/07 08:59 AM
Attachment LANG-346.patch [ 12363110 ]
Dave Meikle made changes - 07/Aug/07 07:03 AM
Attachment LANG-346.patch [ 12363110 ]
Dave Meikle made changes - 07/Aug/07 07:04 AM
Attachment LANG-346.patch [ 12363303 ]
Henri Yandell made changes - 08/Aug/07 03:50 PM
Assignee Henri Yandell [ bayard ]
Henri Yandell made changes - 08/Aug/07 09:37 PM
Attachment LANG-346-fix.patch [ 12363448 ]
Henri Yandell made changes - 09/Aug/07 12:25 AM
Resolution Fixed [ 1 ]
Status Open [ 1 ] Closed [ 6 ]
Henri Yandell made changes - 24/Feb/08 04:24 AM
Link This issue is duplicated by LANG-414 [ LANG-414 ]