Difference between the two dates, calculated in days

kalaimani
Contributor
August 22, 2024

Hello Community

 

My task involves calculating the difference between two dates: one is the issue creation date, and the other is a custom field that automatically populates when the issue transitions to 'Done.' How can I calculate the difference between these dates and, based on the number of days, update the value in a custom field?

 

We don’t use Add-ons here

2 answers

1 accepted

0 votes
Answer accepted
Samuel Gatica _ServiceRocket_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 22, 2024

Hi @kalaimani 

You can utilize automation to achieve this.

Please refer to Date difference {{[date1].diff([date2]).[unit]}} 

Example:

{{now.diff(issue.created).days}}

Screenshot_3.png

 

Hope this helps!

Best regards

Sam

 

 

kalaimani
Contributor
August 22, 2024

Yes ,I tried it same way but i could not get as i expected.Can you help me with this.

Samuel Gatica _ServiceRocket_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 22, 2024

Hi @kalaimani 

Could you please provide a screenshot that displays the details of your automation? Thank you.

 

Best regards

Sam

kalaimani
Contributor
August 29, 2024

Hi @Samuel Gatica _ServiceRocket_ 

 

Test Date 2 is my custom field .

So, in my custom field, the difference in days between issue creation is automatically used to select the dropdown values.

For Example :If the difference between Test Date 2 and the issue creation date is 1, the automation will select dropdown value 1.

Screenshot 2024-08-29 at 5.29.06 PM.png

Screenshot 2024-08-29 at 5.26.23 PM.png

Samuel Gatica _ServiceRocket_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 29, 2024

Hi @kalaimani 

Here is an example of how to update the dropdown field based on the outcome of the date difference calculation.

Screenshot_4.png

 

Hope this helps!

Best regards

Sam

Like kalaimani likes this
kalaimani
Contributor
August 30, 2024

Yes, it works for me. Great! Thanks for your help.

 

  • Here What is meant abs ? 
  • If we have a small number of options, this method works. But if I have 200 dropdown values, is there an easier way to handle it?

 

Samuel Gatica _ServiceRocket_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 30, 2024

Hi @kalaimani 

 

  • ABS(expression), Returns the absolute (non-negative) value of the expression
  • You can directly assign the result in the Select field as follows:

{{Test date.diff(issue.created).days.abs}}

Screenshot_1.png

Best regards
Sam

Like kalaimani likes this
kalaimani
Contributor
August 30, 2024

Great !! Yes its working .

 

Thanks again @Samuel Gatica _ServiceRocket_ 

0 votes
Simon König
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.
August 22, 2024

Hi, without addons my suggestion is you could use Jira automation with smart values. Look them up here: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/

And for SmartValue regarding date and time: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/

You can cast any field-value as a smartvalue and then add them.

 

kalaimani
Contributor
August 22, 2024

Thank you sharing the Documents 

Suggest an answer

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

Atlassian Community Events