Date Field passed from form to user task is subtracted by 1 day

cancel
Showing results for 
Search instead for 
Did you mean: 
ataani
Member II

Date Field passed from form to user task is subtracted by 1 day

When Defining a date field in a form, then reference the form in a step (e.x start event). the date filed can be used down the stream. if it is used by a user task as a due date and then try to deploy and run the app. the due date will be one day less the actual date that's passed by the user in the form.

Is this the default behavior in APS, what is the best practice to show the same date that being passed in the form? 

5 Replies
pault
Active Member II

Re: Date Field passed from form to user task is subtracted by 1 day

What version are you using ? I am using Activiti 5.22, and I have a formProperty which is a date that is set in the startEvent which is then used as the dueDate for the following userTask and it seems to work fine. 

ataani
Member II

Re: Date Field passed from form to user task is subtracted by 1 day

Thanks Paul, I am using APS 1.9 Enterprise edition (activiti 5.22). did you have to set a new formProperty in start Event or did you use the reference form only. 
for me I just defined new form with a date field and then the date field can be seen in the user task still showing due date offset with a day less.
e.x say the inpurt due date is Jan 20. the userTask will be due date in 9 days (Jan 19)

pault
Active Member II

Re: Date Field passed from form to user task is subtracted by 1 day

Maybe what I'm doing is different. I use a form in my start event, it's a dummy sales process for testing something else, which asks for customer, value etc. and 'required by' - which is a date - these are all defined as new formPropertys in the start event.  My next user task is then to ship the order, and it sets the task due date to the date entered on the start event form - e.g. activiti:dueDate="${requiredBy}" 

agnishu
Active Member

Re: Date Field passed from form to user task is subtracted by 1 day

has there been any solution to this? i also found this in the activiti app community version (latest).

the dates are always less by 1 day. the timezone is also the same.

i need to do something before it starts corrupting the reports and user found about it.

agnishu
Active Member

Re: Date Field passed from form to user task is subtracted by 1 day

I did a workaround to get over this issue-

add these 2 lines to add one more day to the input form field in render-form.js

-----------

else if (field.type === 'date' && field.value) {

//added below 2 lines
var days = field.value.getDate();
field.value.setDate(days+1);
postData.values[field.id] = field.value.toISOString().slice(0, 10);