Good afternoon all!!
I am trying to find out how to calculate the difference betwen two dates field and use the result to set another field number data type using JMWE set fields post function
Does anybody know how to do it?
Thanks in advance
Ro
On Jira Cloud, you can use the date('diff') Nunjucks filter, as described here: https://innovalog.atlassian.net/wiki/spaces/JMWEC/pages/108200221/date+filter#datefilter-Datecalculations
For example:
{{ issue.fields["End Date"] | date('diff', issue.fields["Start Date"], 'days') }}
Hi @Rosana Casilli
Use the scripted groovy function: https://innovalog.atlassian.net/wiki/spaces/JMWE/pages/68878434/Workflow+Post-functions
You just then follow an example like this one: https://community.atlassian.com/t5/Jira-questions/Calculate-number-of-days-between-startDate-date-custom-field-and/qaq-p/676579
Regards
Unfortunately, Rosana is on Jira Cloud.
In that case you may have to play with the other scripted function. https://innovalog.atlassian.net/wiki/spaces/JMWEC/pages/1501265949/Build-your-own+scripted+Post-function
I haven't used it myself but there are some examples in the links.
Thank you David! I didn't know how to used that filters! it worked!
Thank you all!! I tried the solution @David Fischer suggested and it worked. I am still learning to use JMWE
Hi David,
Even i am looking for the same field to calculate the difference between two dates in my Jira ( Data Center) we have a addon like Xray & JMWE, Does will work to use above script?
Chenna
Hi @Channakesa Chindanur
the syntax is different on Server/DC. You can use the secondsBetween and workdaysBetween global functions, as documented here: https://appfire.atlassian.net/wiki/spaces/JMWE/pages/78055921/Groovy+Variables+and+Functions#secondsBetween(Date-from%2C-Date-to)
secondsBetween(issue.get("Start Date"), issue.get("End Date"))
which returns a number of seconds, or
secondsBetween(issue.get("Start Date"), issue.get("End Date")) / 86400
to return a number of days.
It looks like you're new here. Sign in or register to get started.