Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Calculating days from date/time picker fields

Daniel Schillig
Contributor
June 4, 2025

Hello!

My customer has the following requirement:

Changes with a planned downtime of more than 14 days should be labeled.

The fields “Planned Downtime Start” and "...End” are date/time picker fields.

I use the following SmartValue for the calculation, but unfortunately it does not return a value:

 

{{Planned Downtime End.jiraDate.diff(Planned Downtime Start.jiraDate).days}}

 

I output the calculation in the logs:

----

Log

Planned downtime in days: <EMPTY>

----

I also tried to use the custom field IDs with the same result.

Does anyone have any idea where my mistake might be?

 

Thanks and best regards,

Daniel

2 answers

1 accepted

2 votes
Answer accepted
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 4, 2025

Hi @Daniel Schillig 

The diff() function takes date or date / time values: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/#Date-difference---

But, you have added the jiraDate format, which converts the values to text...preventing the diff() from working.  Please try removing that formatting.

 

And...Smart values are name, spacing, and case-sensitive, and often do not exactly match the field names displayed on the Jira pages.  When an incorrect one is used, that returns as null, often leading to unexpected results.

Please use this how-to article to identify the correct smart value (or custom field ID) for your fields before you proceed:

https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/

 

Kind regards,
Bill

Daniel Schillig
Contributor
June 5, 2025

That did the job! Thank you very much!

I have removed the ".jiraDate" and the automation now runs and does the job.

Like # people like this
0 votes
Marc - Devoteam
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 4, 2025

HI @Daniel Schillig 

You need to specify the smart values part issue.<customfield-name>

What is the output in the log if you simply use:

{{issue.Planned Downtime End.diff(issue.Planned Downtime Start).days}}

Daniel Schillig
Contributor
June 5, 2025

Thanks! 

I was able to resolve this with using the field names, but, i think it would be a better practice to use the field IDs, as you mentioned.

Like Marc - Devoteam likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events