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

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

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 Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
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.

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events