Calculate two smart values containing dates

Tomas Slavkovsky May 17, 2023

I am trying to create an automation for how long an issue was in progress. I have two dates now stored as a variable. How I can now show the difference without saving those dates. Alternatively, how I can store those values in the issue without making it visible to other users?

I tried: 

1. Jira smart values - date and time / https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/

{{[date1].diff([date2]).[unit]}}

 

2. Jira smart values - math expressions

{{#=}}......{{/}}

 

Any hint?

From log you can see, I am getting the correct date values.

Screenshot 2023-05-17 at 14.53.06.png

1 answer

0 votes
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 17, 2023

Hi @Tomas Slavkovsky 

First thing: why do you want to hide this valuable piece of information?  Hiding it seems in opposition to the agile concept of transparency.  What problem are you trying to solve by hiding?

Regardless of that answer: mostly hiding the result is possible using visibility or obscurity.  For example, you could write the value to a comment with limited visibility (e.g., Admins only) or you could save the value to an Entity Property...which would be more difficult to see.

 

Next thing: how accurate do you need this value to be? 

  • If it needs to include all possible time in progress (e.g., issues move in/out of in-progress statuses multiple times) you will need to use the audit log.  That is theoretically possible with an automation rule, and it would be more complicated.
  • If your normal case is in-progress just one time, you only need one field for the result, as there is another field which can help statuscategorychangeddate, which is a text date/time, system field updated when an issue changes between categories of to-do, in-progress, and done.

 

Next...Depending upon the field types, you can use diff() as you found in the documentation.  You may need to convert with toDate if your dates are stored as text values.

 

Finally, the measure you are describing is typically called Age of WIP.  Please look at the post below for an example automation rule to calculate that value.  You can alter this rule to handle business days only, and to handle exceptions, as needed, or based on status transitions for finer granularity.

https://community.atlassian.com/t5/Automation-discussions/What-is-your-most-useful-automation-Here-is-mine/td-p/1560668#M34

Kind regards,
Bill

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events