Forums

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

Date calculations

tabdou August 7, 2023

We created a custom field called "Due Date" vs. the system provided "Due date".  I want to be able to create a filter that shows me all the tickets that are within 30 days based on the custom field "Due Date".

I know how to do that based on the "Due date" field using due = "30d" but I need it off the custom field.

1 answer

1 accepted

0 votes
Answer accepted
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.
August 7, 2023

Hi @tabdou -- Welcome to the Atlassian Community!

First thing, why did you create the field with such a similar name to the out-of-the-box field?  I suspect that several things in Jira will have problems with that, such as automation rules.

Next, have you tried using the same syntax with your custom field as you did with the existing (or any other) date field?

Kind regards,
Bill

tabdou August 7, 2023

Excellent question Bill -- unfortunately, that field was created long before I arrived in my org.

Also unfortunately, it's not that clear to me (especially that I'm new to Jira).  So I didn't really do any calculations when using the system provided "Date date".  I found a solution online that literally says "due <= '30d'".  Not sure where "due" comes from though as it seems to be a calculated field based on "Due date".

tabdou August 7, 2023

But to your point, yes I am afraid that Jira might have an issue with fields being called same names with the exception of capitalization.  My guess is that at some point, someone needed a Due Date field and didn't realize one already existed -- not sure!

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.
August 7, 2023

The built-in due date field is indeed a challenge as there are several names and capitalizations for it.  "due", "Due", "duedate"... are a few of the names.

I recommend finding the custom field id for your replacement field and using that in the JQL, such as customfield_12345 <= 30d

tabdou August 7, 2023

Is the custom field id different from the custom field name?  If so, how do I look that up?

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.
August 8, 2023

Yes, they are different and usually represent the same thing.  The exception is when multiple fields are created with the same name in the same Jira site.

Your custom field has a human-friendly name of "Due Date" and the internal name is something like customfield_12345 where the 12345 is the id number.

There are several ways to find this name/id, and one is to use the how-to below.  Essentially you...

  • identify an issue with your field and the value set
  • call the REST API to load the issue and all fields from a browser
  • search for your field, Due Date, on the page...and you will find the field id

https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/

tabdou August 8, 2023

Thank you Bill, this is very helpful -- much appreciated. 

I was able to find the custom field name.  Additionally, your earlier comment "customfield_12345 <= 30d" was very helpful as well. 

I thought I had to do a calculation to determine the difference between the Due Date and Today and select the tickets where the difference is within 30 days.  But based on your comment, it looks like JQL will automatically do the calculation using this format 'customfield_12345 <= 30d'.  I tried it and it works.

Like Bill Sheboy likes this
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.
August 8, 2023

Awesome; I am glad to learn that helped.  Please consider marking this question as "answered" to help other community members find solutions faster.  Thanks!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events