This template displays the time elapsed between two times selected in the date and time fields of your choice.
If either field does not have a value, βNoneβ will be displayed.
For the parameters From and To, pick the Date and time fields that should be compared.
Configuration
To use the Time interval template, simply select it from the template grid. Filter by SLA, aging & compliance timelines to find it faster.
Parameters
To complete the configuration, select values for all parameters.
Edit formula mode
If you click on Edit formula you can see the formula field in the Expression Parser. You can now tweak the expression to create a custom formula field based on this template.
Expression
General expression:
%{{issue.cfTTTTT} != null AND {issue.cfFFFFF} != null ? abs({issue.cfTTTTT} - {issue.cfFFFFF}) : null}
FFFFF and TTTTT are the IDs of the custom field you chose for the βFromβ and βToβ parameter.
Display as
Duration
Formatting style
short
Details
1. What does the expression do?
This expression calculates the absolute time difference (duration) between two specific date and time fields on a work item. If either of the two fields is empty, the expression returns nothing ("null") to avoid calculation errors.
2. Step-by-step breakdown
The expression uses a conditional format (often called a ternary operator) which follows a "Logic ? Result if True : Result if False" structure.
-
{issue.cfTTTTT} != null AND {issue.cfFFFFF} != null:-
This is the starting condition. It checks if both the "To" field (
cfTTTTT) and the "From" field (cfFFFFF) actually contain data. -
Technical Term -
null: In technical terms,nullmeans "empty" or "no value." So,!= nullmeans "is not empty."
-
-
?:-
This symbol acts as a separator. It tells the parser: "If the condition above is met, do the following."
-
-
abs({issue.cfTTTTT} - {issue.cfFFFFF}):-
This is the calculation performed if both fields have values. It subtracts the "From" date from the "To" date.
-
Technical Term -
abs(Absolute Value): This function ensures the result is always a positive number. For example, if the "To" date is accidentally earlier than the "From" date,absturns a negative result into a positive one so you still see the total time elapsed.
-
-
::-
This symbol means "otherwise."
-
-
null:-
This is the final result if the first condition isn't met (i.e., if one of the fields is empty). It ensures the field remains blank instead of showing an error.
-
3. Examples
-
Scenario A: Your "From" field is June 1st and your "To" field is June 3rd. The expression calculates the difference and displays 2 days.
-
Scenario B: Your "From" field is June 1st, but the "To" field is empty. The expression sees the empty field and displays None.
4. Real-life use cases
-
SLA Tracking: Calculate the time elapsed between when a work item was "Created" and when it was "Resolved" to see if it met service level agreements.
-
Approval Cycles: Measure how long a work item stayed in a specific phase by comparing a "Start Approval" date field with an "Approval Granted" date field.
-
Delivery Lead Time: Calculate the duration between a "Target Start Date" and the "Actual Delivery Date" to analyze team performance or delays.