How to Calculate Days between Issue Creation and Resolution Date in JIRA

Introduction

Assume you want to watch how long it takes (on average) to resolve issues. JIRA is providing quite a number of reporting options like the Control chart report and much more. But these are pretty complex things to grasp, and in the end, you just need to know how many days it took to resolve a date, expressed in days.

Steps

Just head over to our favorite add-on (the scriptrunner), create a new scripted field ‘days to resolve’, and attach it to the correct screens.

The scripted field allows running a piece of groovy code to calculate the days between the issue creation and resolution date :

import groovy.time.TimeDuration
import groovy.time.TimeCategory
 
if (issue.resolution == null) {
    return null
}
 
TimeDuration duration = TimeCategory.minus(issue.resolutionDate,issue.created)
return duration.days

That’s it. You’re free to test it on your own! And if you need, just contact us.

Outline

Subscribe to our newsletter to receive Idalko’s insights & events

    Related Articles