Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Calculate time difference between custom date fields

Natasha Denny
Contributor
January 14, 2019

I'm trying to calculate the difference between two custom date fields, and then populate a third custom field with the variance in days. 

I'm using Jira Software Cloud and have Automation for Jira plug in. 

Can anyone help? 

2 answers

0 votes
Brydie McCoy (CB)
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.
January 15, 2019

Automation for Jira does provide some built-in date manipulation functions including calculating the difference between two dates: 

https://docs.automationforjira.com/working-with-issue-data/date-functions.html#calculating-the-difference-between-two-dates

For example:

Screen Shot 2019-01-16 at 9.27.35 am.png

Cheers,
Brydie [Automation for Jira]

Natasha Denny
Contributor
January 15, 2019

This is what I've been trying to do, however, the field I want to update doesn't appear in the drop down.... 

What field type should the field I want to set be? Its currently a number field

Do you know what the advanced formula would be that I can include in "More Options"? 

Brydie McCoy (CB)
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.
January 17, 2019

The equivalent json for the "more options" would be:

{ 
"fields": {
"Days since last updated": "{{issue.updated.diff(issue.created).days}}"
}
}

I don't see any reason why a number field shouldn't work.  If you are still having trouble feel free to raise a support request and we can look into your configuration further.

0 votes
Iago Docando
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.
January 15, 2019

Jira Misc Custom Fields is a Free plugin wich adds some neat custom field types, among them are: calculated date/time, calculated number and calculated text.

Not sure if the plugin is availiable for the cloud version or if it is just for the server version but I think it is worth checking.

Hope it helps.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events