The goal is to replace the long "Days since Last Comment" with the short "D:HH:MM:
This can be done via a Scripted Field from JIRA Scriprunner:
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.Issue import com.atlassian.jira.issue.IssueManager import java.text.SimpleDateFormat // https://docs.atlassian.com/jira/server/com/atlassian/jira/issue/Issue.html // https://www.tutorialspoint.com/groovy/groovy_operators.htm long updatedDateTime; // If No Comments, use: updatedDateTime = issue.updated.getTime() // If has Comments, use date of Last Comment: def comments = ComponentAccessor.commentManager.getComments(issue) if (comments) { updatedDateTime = comments.last().getUpdated().getTime() } // Find Now long Now = System.currentTimeMillis() if (updatedDateTime) { // 1s = 1000 ms // Diff is positive, its now-lastupdated in seconds int Diff= (Now-updatedDateTime)/1000 // 1d = 86400s // Get Remains in seconds int Remains = Diff%86400 int Days = (Diff-Remains)/86400 String sDays = String.valueOf(Days) // 1h = 3600s int Remains2 = Remains%3600 int Hours = (Remains-Remains2)/3600 String sHours = "0" + String.valueOf(Hours) int Mins =Remains2/60 String sMins = "0" + String.valueOf(Mins) return sDays + ":" + sHours.reverse().take(2).reverse() + ":" + sMins.reverse().take(2).reverse() } else { return "0:00:00" }
Another very Short version displaying "1d 12h 35m" using DateUtils
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.Issue import com.atlassian.jira.issue.IssueManager import java.text.SimpleDateFormat import com.atlassian.core.util.DateUtils // https://docs.atlassian.com/jira/server/com/atlassian/jira/issue/Issue.html // https://www.tutorialspoint.com/groovy/groovy_operators.htm long updatedDateTime; // If No Comments, use: updatedDateTime = issue.updated.getTime() // If has Comments, use date of Last Comment: def comments = ComponentAccessor.commentManager.getComments(issue) if (comments) { updatedDateTime = comments.last().getUpdated().getTime() } // Find Now long Now = System.currentTimeMillis() // 1s = 1000 ms // Diff is positive, its now-lastupdated in seconds int Diff= (Now-updatedDateTime)/1000 return DateUtils.getDurationString(Math.round((Diff) as Double)) ?: "0m"