You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hello,
I want to calculate the difference between two dates.
I created two custom fields. A DateTime Picker to store the pull request time (called "Pull request opening date"). And another "Total pull request time" field of type Number to store the difference.
In my automation I'm doing the calculation as follows:
{{now.diff (Pull request opening date.value) .minutes}}
Is not working. Automation is performed with success, but does not generate any results. The result field is "empty". I figured the reason was that there was no a completed hour difference between dates, just minutes. So I switched to "minutes", but it still doesn't work.
Filtering the issue in Jira, the value of the data field is 03/Sep/20 2:35 PM.
Someone to help me?
I am trying this very same thing trying to update a number field "Days" with the number of days that have passed since the issue Start Date. While the automation runs to success and says the issues were edited, the number field "Days" remains empty.
{{issue.startDate.diff(now).days.abs}}
I cannot figure out why this does not do anything. I've reviewed the documentation and am stumped
Minor correction - If there is a value in the Day field already, the automation is setting it to null. So this calculated value is returning null. I don't get it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @beacon_grayson - It is better if you create a new question in the Community. That way more people will see it and respond, and specific details to your situation can be discussed. Please post your full rule with the new question, especially showing the details of the field update in the Edit Issue component.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Do this works for timestamp instead of dates?
I have a Timestamp called "WIN Timestamp" saving 'now' when the WIP started and WIP Time to calculate the diff from WIP Timestamp and now. I use the formula below {{issue.WIP Timestamp.diff(now).minutes}} but as a resolve I got Dec 31 ,2001. Not sure what I'm missing.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For something like this, please consider creating a new question or staying on the original thread.
The answer to your question is: yes. The earlier examples all use date/time fields. Here is an example I use to measure Lead Time in fractional days.
{{#=}}ROUND({{issue.Created.diff(issue.Resolved).millis}} / (1000*60*60*24), 3){{/}}
Please consider logging your WIP Timestamp field, as it may not be set to a date/time value or could be null.
Best regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Dionei Piazza - Try putting issue. in front of the field:
{{now.diff(issue.Pull request opening date.value).minutes}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
As this is already a date/time field, you may not need the .value part. I didn't need it when I use custom fields of that type with smart value functions.
Best regards,
Bill
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.
Hey @Bill Sheboy
I follow de Atlassian Jira documentation of smart values.
If I understood what you said, would the automation script be like this:
{{now.diff(issue.Pull request opening date).minutes}} ??
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes - try that.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @John Funk and @Bill Sheboy
I did the execution with {{now.diff(issue.Pull request opening date).minutes}} and the result was negative. :(
Start date: 04 / Sep / 20 9:46 AM
End date: 04 / Sep / 20 9:50 AM
Result: -4
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Maybe you need to switch the order of the fields.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks @John Funk
But, If I need to have the difference between "Now" and the first date that represents the "Opening of the Pull request", I think it is already in the right order.
{{now.diff(issue.Pull request opening date).minutes}}
What I tried now was to use "abs" to guarantee a positive number. let me see the result
{{now.diff (issue.Pull request opening date).abs.minutes}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Interesting,
Now, looking at the documentation https://support.atlassian.com/jira-software-cloud/docs/smart-values-date-and-time-functions/
I found this:
Example
For an issue was created 4 weeks ago:
{{now.diff (issue.created) .weeks}}
// returns
-4
This issue was created {{now.diff (issue.created) .weeks.abs}} weeks ago.
// returns
This issue was created 4 weeks ago.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
For the diff function, the earlier value comes first. Trying what John suggests, you would use: {{issue.Pull request opening date.diff(now).minutes}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Dionei Piazza - Did you ever get this solved?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Wondering how you folks were accounting for things like working hours and weekends in your calculations here? As far as im aware, a date diff will look at actual dates and times, regardless of what your working hours are set to. Itll also factor weekends in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For automation rules, there is a business days, unit of measure option for diff(). That one is based on weekdays and not any site or project-defined values for working days.
There is no option for "working hours". I have seen community posts where people added math operations to adjust for "working" time frames.
Kind regards,
Bill
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.