commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christian (JIRA)" <>
Subject [jira] Created: (LANG-677) DateUtils.isSameLocalTime does not work correct
Date Wed, 02 Feb 2011 15:10:28 GMT
DateUtils.isSameLocalTime does not work correct

                 Key: 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.

Calendar a = Calendar.getInstance();

Calendar b = Calendar.getInstance();

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:


View raw message