I am trying to have a custom field show how many days a issue has been open. I am using the script runner and created a script field. I am trying to find current date - created date for the days open. Here is the script
import com.atlassian.core.util.DateUtils
DateUtils.getDurationString(((new Date().getTime() - issue.getCreated().date) / 1000 / 3600 / 24 ) as long)
But the date is not showing up correctly.
I also want to exclude issue that are in a closed status here is what i have tried to add
import com.atlassian.core.util.DateUtils
def Status = issue.getStatusObject();
if (Status == Closed) {
return null;
}
DateUtils.getDurationString(((new Date().getTime() - issue.getCreated().date) / 1000 / 3600 / 24 ) as long)
but it comes back with an error of No such property: Closed for class: Script7* (* this number keeps growing when you press preview).
This is so i can use the field in a gadget on the dashboard.