I have two custom fields, both are date and time pickers.
I would like to be able to calculate the duration of time between the two fields and express it as a third custom field.
I'm currently using a crude automation rule which edits the 'duration' field when the start or end fields are edited, with the value: {{customfield_10999.diff(customfield_11251).hours}}
This returns a number in hours. I could also set it to .days.
But is there a way to return it in minutes, if less than X minutes, hours, if less than X hours, and otherwise days?
Also, which field type would be best for the 'duration' custom field?
Thank you in advance!!
EDIT: I have discovered that simply removing the unit displays the time in all units, as seen here: {{customfield_10999.diff(customfield_11251)}}
However that just leaves the ideal Field Type to use to house this information. I have created a custom field with the Time in Status type, but this field doesn't show up as a target for Edit Field in Automation rules.
Is there a better custom field type to display a time duration?
1. create a numeric field called ( number of days or number of hours for example )
2. create a date picker field ( call it date 1 and memorize its id number for example lets say its number is 123 )
3. create a date picker field ( call it date 2 and memorize its id number for example lets say its number is 345 )
Now create an automation rule
trigger issue field value changed or transition to done for example
actions - edit issue field - choose field date 1 and set the value
{{now}}
trigger issue created
actions - edit issue field - choose date 2 field and make it to copy from Resolved field
action - edit issue field - choose field number of hours and make it this value
{{issue.customfield_123.diff(issue.customfield_345).hours}}
don't forget to change the fields ids according to you also change the triggers according to your requirements you can also make it days instead of hours
Thanks Omar, that's really helpful
I decided to use {{customfield_10999.diff(customfield_11251)}}
Without .hours or .days on the end, it actually displays all units.
e.g. 3 days 21 hours 31 minutes,
Thank you!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.