[jboss-jira] [JBoss JIRA] Created: (JBPM-775) Business Calendar doesn't add days, weeks, months correctly when daylight savings time begins or ends
Randy Tielking (JIRA)
jira-events at jboss.com
Wed Nov 8 12:21:41 EST 2006
Business Calendar doesn't add days, weeks, months correctly when daylight savings time begins or ends
-----------------------------------------------------------------------------------------------------
Key: JBPM-775
URL: http://jira.jboss.com/jira/browse/JBPM-775
Project: JBoss jBPM
Issue Type: Bug
Components: Core Engine
Affects Versions: jBPM 3.1.2
Environment: All environments
Reporter: Randy Tielking
Assigned To: Tom Baeyens
Priority: Minor
When the BusinessCalendar's add method is called with a duration of days, weeks, or months and the time duration will span the beginning or end of daylight savings time, an unexpected time is returned. Typically if a timer should go off at 5:00 pm everyday, you still want it to go off at 5:00 pm before and after you "spring forward" or "fall back".
For example:
public class BusinessCalendarTest extends TestCase {
/**
* Tests that the BusinessCalendar still gets the time right when daylight savings time change occurs
* @throws Exception
*/
public void testCanHandleStartingDaylightSavingsTimeWhenAddingDays ( ) throws Exception {
BusinessCalendar businessCalendar = new BusinessCalendar();
Duration oneDayDuration = new Duration("1 day");
DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss z");
df.setTimeZone(TimeZone.getTimeZone("US/Eastern"));
Date startDate = df.parse("2006/04/02 01:55:00 EST"); // Sunday at 1:55 am EST
Date newDate = businessCalendar.add(startDate, oneDayDuration); // now Monday at 1:55 am EDT
assertEquals("2006/04/03 01:55:00 EDT", df.format(newDate));
}
}
This test fails the assert with:
junit.framework.ComparisonFailure: expected:<2006/04/03 0[1]:55:00 EDT> but was:<2006/04/03 0[2]:55:00 EDT>
If you want to run every 24 hours instead of the same time every day, you could use a duration of 24 hours.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list