Forums

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

Automation: Convert Text (within Code) to JiraDate.

jeffrey.schrik
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 23, 2022

Hi,

I am new to Jira Automation, I am looking to insert a hard date into my automation code for further manipulation.

How do I convert a hard date within the code?

{{issue.summary.toDate("2022 01 31")}}

{{[issue.dueDate.jiraDate].diff(issue.summary.toDate("2022 01 31")).Days}}

My End goal is a formula similar to the following:

Var1: RoundUp [  (([DueDate] - [HardDate] + 1) / 70 ), 0]

Var2: RoundDown [ ( (Var1 -.01) /5),0 ]

Then to have a logic tree that:

If Var1 < 6 

   Then: "22."& Var1

   Else: 22 + Var 2 & "." [Var1 - (5*Var2)]

Then to have a second logic set that does the same as above except divides Var by 14 and an end formula of:

Var1(14)/[Var2(14)*5]

Ultimately, I am syncing Jira/Jira Align TargetStart/Due dates, and trying to store the PI & Sprint info as Integers in a field to build further logic on.

1 answer

0 votes
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.
March 23, 2022

Hi @jeffrey.schrik -- Welcome to the Atlassian Community!

Perhaps try storing the fixed date using Create Variable, in the format yyyy-mm-dd and explicitly convert to date type when needed:

{{varMyFixedDate.toDate}}

IMHO, there are some limitations to where created variables can be used:

  • Functions: works
  • Smart value, list filtering: does not work
  • Functions in math operators: sometimes work, depending upon the syntax used
  • Branch sources: works

If you get stuck on implementing your use case please post images of your rule and audit log details so the community can help.  Thanks!

Kind regards,
Bill

Suggest an answer

Log in or Sign up to answer