Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Getting result in negative.

shivani_shirguppi December 17, 2024

 

 

I want to calculate how much time the ticket took from creation to resolve using automation. I have used 

{{issue.resolutiondate.diff(issue.created).hours}} Hours 

smart value but after running the automation I am getting the negative result (ex -97 hours) even if the resolved date is after created date

1 answer

1 accepted

1 vote
Answer accepted
Tuncay Senturk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 17, 2024

Hi @shivani_shirguppi 

What I'd do first is to ensure both {{issue.created}} and {{issue.resolutiondate}} have valid, properly formatted values. You can test this by logging these dates

 

Created: {{issue.created}}
Resolved: {{issue.resolutiondate}}

If the difference still shows as negative, it might be because the smart value's .diff() method interprets the order incorrectly. You can use the .abs() function to handle this or the other way around

 

{{issue.resolutiondate.diff(issue.created).hours.abs}} Hours
or 
{{issue.created.diff(issue.resolutiondate).hours.abs}} Hours
shivani_shirguppi December 17, 2024

Thank you so much @Tuncay Senturk 

Tuncay Senturk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 17, 2024

No problem! I'm glad it helped.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events