[jbpm-issues] [JBoss JIRA] Commented: (JBPM-1776) BusinessCalendar.add(Date, Duration) delivers unexpected results

juanm pd (JIRA) jira-events at lists.jboss.org
Tue Jan 5 04:08:30 EST 2010


    [ https://jira.jboss.org/jira/browse/JBPM-1776?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12502162#action_12502162 ] 

juanm pd commented on JBPM-1776:
--------------------------------

I thing JBPM-1776 should not have been rejected.
I agree with Petr Nejedly. Negative durations must be supported.
Negative duration are needed in common business use cases. For example, the user specifies a date for a meeting to take place, and 2 business days before that date, we want to send a remind mail to the attendees, or create a task to prepare the material for the meeting... We work for the administration, and have real use cases involving legal terms and time limits when negative durations are needed, furthermore, negative business durations.
According to the jbpm documentation (http://docs.jboss.com/jbpm/v3.2/userguide/html_single/#duration), it should be supported, as it clearly stands that the 'Duedate' may be expressed as the sum or substraction (+/-) of a duration to a basedate:
>16.1. Duedate
> As mentioned the due date is composed of a duration and a base date. If this base date is ommitted,
> the duration is relative to the date (and time) at the moment of calculating the duedate. The format is:
> duedate ::= [<basedate> +/-] <duration>

> BusinessCalendar.add(Date, Duration) delivers unexpected results
> ----------------------------------------------------------------
>
>                 Key: JBPM-1776
>                 URL: https://jira.jboss.org/jira/browse/JBPM-1776
>             Project: jBPM
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>    Affects Versions: jBPM 3.2.3
>         Environment: java.version 1.5.0_13
> java.vm.version 1.5.0_13-b05
> os.name Windows XP
> os.version 5.1
> Manifest-Version: 1.0
> Ant-Version: Apache Ant 1.7.0
> Created-By: 1.7.0-b21 (Sun Microsystems Inc.)
> Implementation-Title: jBPM Core Library
> Implementation-Version: 3.2.3 (date:18-Jun-2008 00:51)
> Implementation-URL: http://www.jboss.org/
> Implementation-Vendor: JBoss Inc.
> Implementation-Vendor-Id: http://www.jboss.org/
>            Reporter: J���¼rgen Lampe
>            Assignee: Alejandro Guizar
>             Fix For: jBPM 3.2.x
>
>
> When subtracting business time amounts from a date, the result is after the date and not - as one would expect - before this date.
> Examples:
>  Sat Nov 01 00:00:00 CET 2008 + 2 business days -> Tue Nov 04 17:00:00 CET 2008 - OK
>  Sat Nov 01 00:00:00 CET 2008 - 2 business days -> Sun Nov 02 18:00:00 CET 2008 - unexpected
>  Sat Nov 01 00:00:00 CET 2008 + 2 business hours -> Mon Nov 03 11:00:00 CET 2008 - OK
>  Sat Nov 01 00:00:00 CET 2008 -2 business hours -> Mon Nov 03 07:00:00 CET 2008 - unexpected
> Data was created by use of small test program:
> 			Date date=new SimpleDateFormat("dd.MM.yyyy").parse("01.11.2008");
> 			String[] durStrs= {"+ 2 business days", "- 2 business days", "+ 2 business hours", "-2 business hours"};
> 			BusinessCalendar calendar= new BusinessCalendar();
> 			for (String durStr: durStrs) {
> 				Duration duration= new Duration(durStr);
> 				Date d= calendar.add(date, duration);
> 				System.out.println(" "+date+" "+durStr+" -> "+d);				
> 			}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       



More information about the jbpm-issues mailing list