You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Henri Yandell (JIRA)" <ji...@apache.org> on 2008/11/05 18:01:46 UTC
[jira] Closed: (LANG-440) DateUtils.round doesn't work correct for
Calendar.AM_PM
[ https://issues.apache.org/jira/browse/LANG-440?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Henri Yandell closed LANG-440.
------------------------------
Resolution: Fixed
svn ci -m "Applying Robert Scholte's excellent unit tests from LANG-443 and his second patch from LANG-440 fixing a discovered boundary case for AM_PM in round"
Sending pom.xml
Sending src/java/org/apache/commons/lang/time/DateUtils.java
Adding src/test/org/apache/commons/lang/time/DateUtilsRoundingTest.java
Sending src/test/org/apache/commons/lang/time/TimeTestSuite.java
Transmitting file data ....
Committed revision 711616.
> DateUtils.round doesn't work correct for Calendar.AM_PM
> -------------------------------------------------------
>
> Key: LANG-440
> URL: https://issues.apache.org/jira/browse/LANG-440
> Project: Commons Lang
> Issue Type: Bug
> Affects Versions: 2.4
> Reporter: Robert Scholte
> Fix For: 3.0
>
> Attachments: LANG-440-2-rs.patch, LANG-440-rs.patch
>
>
> The provided JUnit-tests test with wrong expected values
> {code:title= original DateUtilsTest.java}
> dateAmPm1 = dateTimeParser.parse("February 3, 2002 01:10:00.000");
> dateAmPm2 = dateTimeParser.parse("February 3, 2002 11:10:00.000");
> dateAmPm3 = dateTimeParser.parse("February 3, 2002 13:10:00.000");
> dateAmPm4 = dateTimeParser.parse("February 3, 2002 19:10:00.000");
> assertEquals("truncate ampm-1 failed",
> dateTimeParser.parse("February 3, 2002 00:00:00.000"),
> DateUtils.round(dateAmPm1, Calendar.AM_PM));
> assertEquals("truncate ampm-2 failed",
> dateTimeParser.parse("February 4, 2002 00:00:00.000"),
> DateUtils.round(dateAmPm2, Calendar.AM_PM));
> assertEquals("truncate ampm-3 failed",
> dateTimeParser.parse("February 3, 2002 12:00:00.000"),
> DateUtils.round(dateAmPm3, Calendar.AM_PM));
> assertEquals("truncate ampm-4 failed",
> dateTimeParser.parse("February 4, 2002 12:00:00.000"),
> DateUtils.round(dateAmPm4, Calendar.AM_PM));
> {code}
> but expected values must be
> {code}
> dateTimeParser.parse("February 3, 2002 00:00:00.000");
> dateTimeParser.parse("February 3, 2002 12:00:00.000");
> dateTimeParser.parse("February 3, 2002 12:00:00.000");
> dateTimeParser.parse("February 4, 2002 00:00:00.000");
> {code}
> Also in the junit-comment the word 'truncate' must be replaced with 'round'
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.