commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henri Yandell (JIRA)" <j...@apache.org>
Subject [jira] Commented: (LANG-346) Dates.round() behaves incorrectly for minutes and seconds
Date Tue, 07 Aug 2007 03:29:59 GMT

    [ https://issues.apache.org/jira/browse/LANG-346?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12518061
] 

Henri Yandell commented on LANG-346:
------------------------------------

The patch fails for me. I'm on PDT rather than GMT and the time is off by 8 hours.

Testcase: testRoundLang346(org.apache.commons.lang.time.DateUtilsTest): FAILED
Minute Round Up Failed expected:<Mon Jul 02 09:09:00 PDT 2007> but was:<Mon Jul 02
01:09:00 PDT 2007>
junit.framework.AssertionFailedError: Minute Round Up Failed expected:<Mon Jul 02 09:09:00
PDT 2007> but was:<Mon Jul 02 01:09:00 PDT 2007>
    at org.apache.commons.lang.time.DateUtilsTest.testRoundLang346(DateUtilsTest.java:704)

> Dates.round() behaves incorrectly for minutes and seconds
> ---------------------------------------------------------
>
>                 Key: LANG-346
>                 URL: https://issues.apache.org/jira/browse/LANG-346
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 2.2, 2.3
>            Reporter: Ken Dombeck
>             Fix For: 2.3.1
>
>         Attachments: LANG-346.patch
>
>
> 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

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message