Days until date

📚

This template displays the days until the date selected in the date field of your choice will be reached (from today).

If the field does not have a value, “None” will be displayed.

For the parameter Date, pick the Date field that should be compared against the current day.

Configuration

To use the Days until date 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.

grafik-20250602-091901.png

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.cfNNNNN} != null ? datePart({issue.cfNNNNN},RUN_AS_LOCAL) - datePart({system.currentDateTime},RUN_AS_LOCAL) : null}

NNNNN is the ID of the custom field you chose for the “Date” parameter.

Display as

Duration

Formatting style

short

Used parser functions

The links lead to the JWTC documentation because the parser functions are shared functionalities.

Details

1. What does the expression do?

The purpose of this expression is to calculate the number of days until the given date stored in a custom field (the "Date") is reached. If the date field is empty, the expression returns nothing ("null"), which results in "None" being displayed to the user.

2. Step-by-step breakdown

The expression is:
%{%{issue.cfnnnnn} != null ? datePart({issue.cfnnnnn},RUN_AS_LOCAL) - datePart({system.currentDateTime},RUN_AS_LOCAL) : null}

  • %{ ... }: This is the wrapper for the expression, telling the system to evaluate the logic inside.

  • issue.cfnnnnn != null: This checks if the custom field (where nnnnn is the ID of your chosen date field) actually contains a value. It ensures the calculation only runs if there is a date to compare.

  • ? ... : ...: This is a conditional operator (often called an "If/Else" statement). If the condition before the ? is true, it runs the first part; otherwise, it runs the part after the :.

  • datePart({issue.cfnnnnn}, RUN_AS_LOCAL):

    • issue.cfnnnnn: This returns the stored value in your custom field.

    • datePart(..., RUN_AS_LOCAL): This function extracts the date portion (ignoring the specific time) and adjusts it to your local time zone.

  • - datePart({system.currentDateTime}, RUN_AS_LOCAL): this subtracts the today’s date from the date in your custom field. Because it uses datePart, it calculates the difference in full days.

  • : null: If the custom field was empty, this part is triggered, returning no value.

3. Examples

  • Scenario A (Date exists): If your “Date field” (e.g., “Start Date”) is set to June 8, 2026, and today is June 1, 2026, the expression calculates June 8 - June 1.

    • Result: 7

  • Scenario B (Empty field): If the "Start Date" field is empty.

    • Result: None (or null)

4. Real-life use cases

This expression is highly useful for tracking timelines and aging within your work items:

  • Project Deadlines: Automatically display a countdown on a work item for a "Go-Live" or "Milestone" date so the team knows exactly how much time is left.

  • SLA & Compliance: Track how many days remain before a regulatory deadline is reached.

  • Onboarding: For HR teams, track the days remaining until a new hire's "Start Date" to ensure all equipment is ready in time.