Breadcrumbs

Time left until due date

📚

Return the duration between the current date and the due date of the current work item in days.

Configuration

Create a Custom smart number field and use the General parsing mode.

Expression

%{{issue.dueDate} != null ? max({issue.dueDate} - {system.currentDateTime}, 0) / DAY
: null}

If the resulting number from the expression contains too many decimal numbers, feel free to select one of the available display formats or to configure it manually.

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 remaining between today and the due date of the current work item. If there is no due date set, it returns “None” (null). If the due date has already passed, it returns 0.

2. Step-by-step breakdown

Let’s break it down:

  • {issue.dueDate} != null: Checks if the work item has a due date set.

  • ? ... : ...: This is a conditional (if-then-else) statement. If the due date exists, it calculates the time left; if not, it returns null.

  • {issue.dueDate} - {system.currentDateTime}: Subtracts the current date and time from the due date, giving the time difference in milliseconds.

  • max(..., 0): Ensures the result is never negative. If the due date is in the past, it returns 0 instead of a negative number.

  • / DAY: Converts the time difference from milliseconds to days.

  • null: If there is no due date, the result is null (“None” is shown).

3. Examples

  • If today is November 26 and the due date is November 30, the result will be 4.

  • If today is November 26 and the due date is November 24 (already passed), the result will be 0.

  • If there is no due date set, the result will be “None” (null).

4. Real-life use cases

  • Displaying a countdown of days left until a work item is due, helping teams prioritize tasks.

  • Highlighting overdue work items by showing 0 days left.

  • Leaving the field blank for work items without a due date, avoiding confusion.