Return the difference in days between the current day and the earliest due date from the sub-tasks of the current work item.
Configuration
Create a Custom smart number field and use the General parsing mode.
Expression
%{max(fieldValue({issue.dueDate},subtasks())) != null ? ceil((min(filterByValue(
fieldValue({issue.dueDate},subtasks()),!=, null )) - {system.currentDateTime}) /
DAY) : null}
Display as
Number
Formatting style
Default (unformatted)
Used parser functions
The links lead to the JWTC documentation because the parser functions are shared functionalities.
Details
1. What does the expression do?
This expression calculates the number of days between today (the current day) and the earliest due date among all sub-tasks of the current work item. If none of the sub-tasks have a due date, the result will be “None” (null).
2. Step-by-step breakdown
Let’s break it down:
-
fieldValue({issue.dueDate},subtasks())-
This collects the due dates from all sub-tasks of the current work item.
-
-
max(fieldValue(...)) != null ? ... : null-
Checks if at least one sub-task has a due date. If none do, the expression returns null.
-
-
filterByValue(fieldValue(...), !=, null)-
Filters out the value of any sub-task that does not have a due date (removes null values).
-
-
min(...)-
Finds the earliest (soonest) due date among the sub-tasks.
-
-
{system.currentDateTime}-
Represents the current date and time.
-
-
(min(...) - {system.currentDateTime}) / DAY-
Calculates the difference between the earliest sub-task due date and today, in days.
-
-
ceil(...)-
Rounds the result up to the next whole number (so partial days count as a full day).
-
3. Examples
-
If today is November 13 and the earliest sub-task due date is November 15, the result will be 2.
-
If today is November 13 and the earliest sub-task due date is November 13 (today), the result will be 0.
-
If none of the sub-tasks have a due date, the result will be None (null).
4. Real-life use cases
-
Project tracking: Quickly see how many days remain until the next sub-task is due, helping you prioritize work.
-
Reporting: Use this value in dashboards or reports to highlight work items with upcoming deadlines.
-
Automation: Trigger reminders or escalations when the number of days until the next sub-task due date is low.