Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Get only days and not week, days, hours, minutes

Susanne Harelius
Contributor
May 6, 2018

I have a scripted field that return the duration (the time an issue has been in the current status). We need that in overview kanban boards and to be able to perform searches it needs to be a duration search. 

.....

accumulatedTime += new Date().getTime() - currentStatusTime
return accumulatedTime/(1000) as long ?: 0L

.....

In the field it looks like: Days in status:21 weeks, 2 days, 18 hours, 47 minutes

I would like it to say how many days only. So in this case 149 days. 

 

1 answer

0 votes
Gezim Shehu [Communardo]
Community Champion
May 7, 2018

Have you tried configuring the template as Duration, instead of Duration (time-tracking)?

Susanne Harelius
Contributor
May 7, 2018

It is a Duration template... :(

Gezim Shehu [Communardo]
Community Champion
May 7, 2018

You're right. I couldn't get it to display as days either.

The template is a system default one, used also for other system configured fields.

 

You could try the other templates:

1-Text (not exactly searchable)

2-Number (my recommendation - the field name has to contain "Days" so it will justify the unit and the output would be an integer).

 

 So if field name would be "Days in Current Status" an example output 149.

Susanne Harelius
Contributor
May 7, 2018

What I then need is for it to say Days afterwards. It is wanted in the boards for everyone to understand the number. It would work with number since it is comparing they want. 

How would you do that? 

Gezim Shehu [Communardo]
Community Champion
May 7, 2018

I get it.

Well you could try the text template adding number converted into days (let's say you have 8 hour days) and simply appending "days" after.

 

Though I have not experimented with searching abilities, since it's a text field and comparing operators should not work.

 

There is one more option, for custom templates. I haven't yet looked into it.

Susanne Harelius
Contributor
May 8, 2018

Well I kind of did that. Appending the days in the field which looks great in the board but searching is not really possible since it is a string. A number would be easier, but duration best :) 

Susanne Harelius
Contributor
May 22, 2018

Thanks for trying to resolve this! I will need to look into deeper how to do this. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events