Calculate end date based on original estimate

Maurice B_ February 11, 2025

Dear community, 

I'm currently struggling with the automated calculation of an end date via Jira Automation. 

I have created two custom fields "Startdate" and "Enddate" formatted as date/time picker. What I would like to have is the automated "Enddate" based on the original estimate which is entered. 

Something like: 

Startdate: 02-11-2025,  04:00pm

Original Estimate: 4:30 hours

Enddate: 02-11-2025,  08:30pm

Im currently creating a variable "TimeTrackingDays" with formula: 

{{#=}}{{issue.timetracking.originalEstimateSeconds}} / (60 * 60 * 8){{/}}

 

and then, I try to update the "Enddate" with formula: 

{{issue.customfield_10041.plusBusinessDays(TimeTrackingDays.asNumber)}}


Unfortunately, the update of the "Enddate" field is not correct as it shows the same date as the "Startdate". 

Do you have any suggestions for the correct formula? 

Thank you so much!

 

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.
February 11, 2025

Hi @Maurice B_ 

For a question like this, context is important for the community to help.  Please post the following:

  • what type of project is this (e.g., company-managed, team-managed, etc.), 
  • an image of your complete automation rule in a single image for continuity,
  • images of any relevant actions / conditions / branches,
  • an image of the audit log details showing the rule execution, and
  • explain what is not working as expected and why you believe that to be the case.

Until we see those...

 

You describe adding those date / time picker fields, but there is already a built-in field named "Start Date" (which is a date picker).  Are you perhaps confusing the two fields?

That could be confirmed by checking your supported smart values for the issue: https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/

 

Next, have you confirmed that your variable, TimeTrackingDays, is an integer as that is what the function plusBusinessDays() takes as a parameter?  You could enforce that by adding the ROUND() function to your variable creation.

 

Kind regards,
Bill

Maurice B_ February 11, 2025

Hi @Bill Sheboy

thank you for your support! 

I know that there is a built in start date field but this only shows the date and no time, and I’m especially looking for the time as well, so this is the reason why I have created a custom field. 

Secondly, the wrong value might be the error. In my test case, the variable‘s result was 0.625, so no integer. But for my case, I need values like this because the original estimate of my tasks is often expressed in hours or minutes and not only complete days. 

Is there another option to use instead of plusBusinessDays to add hours or even minutes to calculate the end date? 

Thank you so much, I really appreciate your help. 

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.
February 11, 2025

Thanks for confirming the field name overlap.  I recommend renaming your new field to avoid collisions, perhaps to Start DateTime.

 

If you need to add the fractional part for business hours, I recommend using this undocumented function, which I just tested again to confirm it still works: plusBusinessHours()  Adjust your variable to calculate in hours (not days), or multiply it by 8 for your work day.

And remember that Jira rules use this definition: "business days are considered to be Monday to Friday, 9am to 6pm"  Thus I recommend converting to your own time zone to help with testing, such as with this:

{{now.convertToTimeZone("America/Los_Angeles").plusBusinessHours(4)}}

 

If that function does not work, your rule will be much more complicated, as it will need to manually parse / adjust the date time to whole working days: add days, add hours, shift to fit within the working day's hours.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events