Working time counter


We want to know how much time we spend working at an issue.

How can we make,  with a workflow, a new field that count, since the issue was createdthe time in days (considering 8 working hours a day and excluding Saturday and Sunday) when the issue is in state OPEN + IN PROCESS?

Comment actions Permalink
Official comment


Unfortunately, this cannot be applied to previous operations. I mean, you cannot fetch this data for existing issues, you can only start counting days since now. 

To implement the process, follow these steps:

1. Create fields which will store the timestamp of state change (e.g. "SubmittedToOpen", "OpenToFixed"). You need such fields for each transaction you'd like to track.
2. Create an on-change rule ( which will trigger on issue state change (ctx.issue.isChanged(ctx.State))
3.  Find out the old and the new values of State field (use oldValue() and becomes() methods;;
4. Store current timestamp ( to the corresponding field

Having dates of states changes, you can easily calculate the number of days spent in a particular state.

Another option is to create an on-schedule rule ( which will run once a day and increase the counter of days if the state is still unchanged. 

Hope it helps. 

Comment actions Permalink


Thank you for answering, you have been very helpful.

But I still have a doubt.

How can I exclude Saturday and Sunday from the counting of the days?

Thanks in advance.

Comment actions Permalink

You can check which day it is in the rule. Please feel free to use getDay() method - it returns the number of the day in a week. 


Please sign in to leave a comment.