Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Smart values date difference using a hard coded value

Hi 

Using Jira cloud automation, I am trying to find out the days difference between a value in jira field to the hardcoded date value divided by 14.

Documentation only provides use cases that find the difference between now and date value in Jira field. 

{{#=}}{{now.diff(issue.Expected Date).days}} / 14 {{/}}

I am trying to find something like below

{{#=}}{{(08/01/2020).diff(issue.Expected Date).days}} / 14 {{/}}

Please can you help how to get the above working?

1 answer

1 accepted

0 votes
Answer accepted
Dario B Atlassian Team Mar 13, 2020

Hello @Manohar Kurapati ,

 

If I understand correctly, you are using automation for Jira Sofware Cloud and you are referring to the below documentation pages:

 

If that's the case, then a quick way to proceed would be to:

  1. Add a custom field to store the hard-coded date, let's call it HardCodedDate
  2. Fill the custom field with the desired date (e.g. 08/01/2020)
  3. Replace 'now' with the HardCodedDate custom field in the formula you already know:
    {{#=}}{{issue.HardCodedDate.diff(issue.Expected Date).days}} / 14 {{/}}

 

 

I hope this helps.

 

Cheers,
Dario

@Dario B , I have a point here.

The example of @Manohar Kurapati is looking for ".days". If the difference between the two dates does not complete a day, is the result 0 (zero) or something like 0.5 days?

Dario B Atlassian Team Jan 29, 2021

Hello @Dionei Piazza ,

Sorry for late reply, I am afraid I have missed your comment. However, even if I have never encountered this scenario myself the assumption is that it returns 0.

Also, looking at the example in the documentation (quoted below) I assume that using prettyPrint the function will return the amount of hours as well:

 displays the difference in words, e.g.: 2 days 3 hours.

 

Please let me know if this is something that you still need to know so that, in case it is, I can ask the Automation team for clarifications.

 

Cheers,
Dario

Like Dionei Piazza likes this
Dario B Atlassian Team Feb 03, 2021

@Dionei Piazza ,

I have asked the automation team and I have been told that it actually depends on the kind of fields:

yes it should display in hours. If both fields are date time fields. If they are just date fields (no time information) then it will likely be 0.

 

I hope this helps

Like Dionei Piazza likes this

Hi @Dario B !

Thank you very much!

Cheers,
Dionei!

Like Dario B likes this
Dario B Atlassian Team Feb 04, 2021

You are very welcome @Dionei Piazza ! :) 

Also, as an advice for the future, you have bigger chances to get a quick reply if you create a new question, instead of adding the question to a thread that is older than couple of months (unless it is an active thread).

 

Cheers,
Dario

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you