Dear @Alexey Matveev
How to stop this from happening as i saved code, when clicking on the customfield the behavior changed it goes on to the pop-up upon click it on the view screen, and I'm confused as I cant edit on the view screen itself as we always do, is there a way to stop it.
I get my day durations like this when I want whole days.
def durationMillis = new Date().time - issue.created.time
def days= Math.round(durationMillis / 1000 / 60 / 60/ 24)
You could also use Math.floor() if you want a day to be counted only after a full 24 hours has passed. Math.round does a simple arithmetic rounding to the nearest integer.
Thank you! I'll check that out too - I really appreciate this :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@PD Sheehan how does this go into the script? Again, I'm very novice at this and I'm not sure how to insert this
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Scripts can be super simple or super complicated. If you don't care that this number will grow forever you can put this is the script exactly as is.
Here is an example:
But you may want to consider stopping the clock when an issue is closed.
In which case you'll have to introduce some more complex logic.
Something like:
def enDate = issue?.resolutionDate ?: new Date()
def durationMillis = endDate.time-issue.created.time
def days= Math.round(durationMillis / 1000 / 60 / 60/ 24)
Something to note about a field like this ... the index (if you select a searcher in the custom field configuration) will only be updated when an issue is otherwise updated.
So don't expect to be able to use this field in filters and have current results.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm still getting an error when I use the first method - any suggestions would be great
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is an inconsequential warning. You can safely ignore it.
If it really bothers you, you can force the data type of your calculation with something like this:
def days= Math.round((durationMillis / 1000 / 60 / 60/ 24) as Double)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
getDurationString translates seconds into a formatted string that breaks down the duration into the largest common divisors.
You should be using one of the other functions, I think. See https://docs.atlassian.com/DAC/javadoc/atlassian-core/4.6.0/reference/com/atlassian/core/util/DateUtils.html for the various options
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you - I'll read through these and see which one would be the best.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.