Given the value of e.g. aggregatetimeoriginalestimate, how do I convert this value in seconds to a pretty print format like "2d 4h"?
Hi @Peder Alm
Have you tried using the diff() with prettyPrint and use a date/time value as an intermediary?
For example, diff on now and now + your field value. Maybe something like this:
{{now.diff(now.plusSeconds(issue.aggregatetimeoriginalestimate)).prettyPrint}}
Kind regards,
Bill
This is pretty close! But sometimes I get something like "2 hours 59 minutes 59 seconds" when I have "3h" as input. Maybe because now is called twice? What if now is just called once to a variable? Is it even possible to work with variables in this small field?
Also if I have "2d" as input I get "16h" as output. Can this be changed sp the output is "2d"?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Maybe that is it...or it is a rounding thing caused by diff() and number representation.
Created variables sometimes work with functions...and sometimes not. You can try it to learn if they are supported for this case.
For example:
For the second part on 2d and 16h, I suspect that is also a rounding thing. I would submit a support ticket to ask Atlassian for that one.
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.
Yes, exactly! I simplified my question, but the origin of my question is mentioned in ∑original estimate ∑Time spent usage . I have calculated a time estimate value and have the result in seconds, but would like to present it in a read-only field. The value in seconds is displayed correctly in the field, but when I try to convert it and change the output using different methods, I don't get what I want, a human readable format, e.g. "2d 4h", instead of displaying seconds or hours.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ahhhh okay. Perfect, thanks for the other details, I now get what you are trying to properly achieve. The short answer is no. As of right now there is no way the automation engine can understand that 60 minutes means one hour and therefore display as 1h.
I tend to find that reporting in minutes is the easiest for my users followed by hours.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I had an idea that I could use the prettyPrint unit from diff() in some way. So I wanted to convert my time estimate value in seconds to a DateTime object (donät know how!) and then diff it to 0, e.g. "myTimeEstimateValueAsDateTimeObject.diff(0).prettyPrint". COuld that be a possible solution?
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.