I am trying to calculate a "Days in [Status]" field in Jira Product Discovery and can't seem to get an output for my formula.
I want to reference a custom date field that indicates the beginning of a project status and re-calculate the days in status on a daily basis with Jira Automation. I've been debugging and checking other posts in the community but have still not been able to solve this.
Here's what I have in debug now:
Now is: {{now.jiraDate}} and Discovery Kickoff is {{issue.customfield_10239.match(".*start.*([0-9]{4}-[0-9]+-[0-9]+)")}}
This works as expected and outputs:
Now is: 2024-10-07 and Discovery Kickoff is 2024-09-03
However, the next line I have for debugging fails:
Date Diff is: {{now.JiraDate.diff(issue.customfield_10239.match(".*start.*([0-9]{4}-[0-9]+-[0-9]+)")).days.abs}}
Returns this:
Date Diff is:
I've tried every formatting combination I'm familiar with and I cannot get this formula to give me a number of days since the Discovery Kickoff date. Any help is hugely appreciated!
Hi @Adam Sigel
When you used the match() function to extract from the JPD date field format, that results in a text value. Please add a toDate call after that to convert before the use in diff():
Date Diff is: {{now.JiraDate.diff(issue.customfield_10239.match(".*start.*([0-9]{4}-[0-9]+-[0-9]+)").toDate).days.abs}}
Kind regards,
Bill
So now when I log:
Now is: {{now.jiraDate}} and Discovery Kickoff is {{issue.customfield_10239.match(".*start.*([0-9]{4}-[0-9]+-[0-9]+)").toDate.jiraDate}}
I get:
Now is: 2024-10-07 and Discovery Kickoff is 2024-08-01
and when I log:
Date Diff is: {{now.JiraDate.diff(issue.customfield_10239.match(".*start.*([0-9]{4}-[0-9]+-[0-9]+)").toDate.jiraDate).days.abs}}
I get:
Date Diff is:
What am I still missing?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Removing the `.jiraDate` did it!
Date Diff is: {{now.diff(issue.customfield_10239.match(".*start.*([0-9]{4}-[0-9]+-[0-9]+)").toDate).days.abs}}
gives me:
Date Diff is: 67
Thank you!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.