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] Closed: (LANG-677) DateUtils.isSameLocalTime does not work correct
Date Thu, 03 Feb 2011 05:23:29 GMT

     [ https://issues.apache.org/jira/browse/LANG-677?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Henri Yandell closed LANG-677.
------------------------------

    Resolution: Fixed

Looks like Niall fixed this.

r1066645 | niallp | 2011-02-02 13:55:15 -0800 (Wed, 02 Feb 2011) | 1 line
Changed paths:
   M /commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/DateUtils.java
   M /commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java

LANG-677 DateUtils isSameLocalTime() compares the hour using 12hour Calendar.HOUR instead
of 24hour Calendar.HOUR_OF_DAY - thanks to Christian


> DateUtils.isSameLocalTime does not work correct
> -----------------------------------------------
>
>                 Key: LANG-677
>                 URL: https://issues.apache.org/jira/browse/LANG-677
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.time.*
>         Environment: linux 2.6.32-28, java version "1.6.0_22"
>            Reporter: Christian
>
> Hi, I think I found a bug in the DateUtils class in the method isSameLocalTime.
> Example: 
> Calendar a = Calendar.getInstance();
> a.setTimeInMillis(1297364400000L);
> Calendar b = Calendar.getInstance();
> b.setTimeInMillis(1297321200000L);
> Assert.assertFalse(DateUtils.isSameLocalTime(a, b));
> This is because the method compares 
> cal1.get(Calendar.HOUR) == cal2.get(Calendar.HOUR) 
> but I think it has to be 
> cal1.get(Calendar.HOUR_OF_DAY) == cal2.get(Calendar.HOUR_OF_DAY)
> 	

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message