The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

Using smart values to set the date with some math operations

Arne Henrichsen
June 20, 2024

Hi,

 

I am trying to set the start date field based on some other parameter:

{{now.withYear(2024).withMonth(1).withDayOfMonth(15).plusDays(issue.Start PI)}}

 

The above works great, but I would like to have the following calculated inside the plusDays function:

 

(issue.Start PI - 3)

 

I have tried various variants, but nothing seems to work:

 

{{now.withYear(2024).withMonth(1).withDayOfMonth(15).plusDays({{#=}}{{issue.Start PI}} - 3{{/}})}}

or

{{#=}}now.withYear(2024).withMonth(1).withDayOfMonth(15).plusDays(issue.Start PI -3){{/}}

 

Any idea how to do this?

 

Thanks in advance

Arne

3 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
Arne Henrichsen
June 20, 2024

Ok, I never saw in the documentation the minus function, so the following solved my problem without creating another variable;

{{now.withYear(2024).withMonth(1).withDayOfMonth(15).plusDays(issue.Start PI.minus(3))}}

 

0 votes
Arne Henrichsen
June 20, 2024

Hi Jovin,

 

I was looking for something like that, but did not find any info on that. Could you point me to some examples? 

Arne Henrichsen
June 20, 2024

Just found the CreateVariable action, I will try it now.

0 votes
Jovin
Community Champion
June 20, 2024

Hey @Arne Henrichsen

Have you tried using "Create Variable" action before and performing the "{{issue.Start PI}} - 3" in that action?

Then you can refer to the variable as a number by then going {{smartValue.asNumber}} in the .plusDays?

Arne Henrichsen
June 20, 2024

I have create a variable called daysOffset, but it is still not working:

{{now.withYear(2024).withMonth(1).withDayOfMonth(15).plusDays({{daysOffset}})}}

or

{{now.withYear(2024).withMonth(1).withDayOfMonth(15).plusDays(daysOffset)}}

On its own, {{daysOffset}} shows the correct number.

 

TAGS
AUG Leaders

Atlassian Community Events