Forums

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

Reports: Find issues that were created after 5pm

Michael Church July 17, 2024

I'm trying to write a report to show issues that were reported after 5pm on the issue creation date.  For testing, I am trying 10am to ensure a data set.

I have a series that is based on Created, and the JQL filter looks like this:

created >= startOfDay("+10h")

The report only shows issues that were created TODAY after 10am.

JQL is so strange and poorly documented that I can't figure out the correct syntax for this.  There is no way that I can find to extract the time component and compare it, and various solutions online use this startOfDay() method, but it appears to use TODAY as the startOfDay() instead of the start of day of the issue's creation date.

(Anyone want to fight me on JQL being strange can explain to me why "labels = Task" translates to "labels contains Task" and yet JQL has a contains operator that is not compatible with the labels field.)

  • Is there a function to retrieve the hour of a date field?
  • Is there a function to retrieve the weekday of a date field?
  • Is there a way to construct this report to show the information I need? (number of issues opened after 5pm on ANY DAY not just today)

Thanks.

 

P.S.: I can do this through brute force and a python script, but I'd rather not.  For instance, this query works for the month of July:

 

created < "2024-07-01 07:00" OR (created > "2024-07-01 21:30" AND created < "2024-07-02 07:00") OR (created > "2024-07-02 21:30" AND created < "2024-07-03 07:00") OR (created > "2024-07-03 21:30" AND created < "2024-07-04 07:00") OR (created > "2024-07-04 21:30" AND created < "2024-07-05 07:00") OR (created > "2024-07-05 21:30" AND created < "2024-07-07 07:00") OR (created > "2024-07-06 21:30" AND created < "2024-07-08 07:00") OR (created > "2024-07-07 21:30" AND created < "2024-07-08 07:00") OR (created > "2024-07-08 21:30" AND created < "2024-07-09 07:00") OR (created > "2024-07-09 21:30" AND created < "2024-07-10 07:00") OR (created > "2024-07-10 21:30" AND created < "2024-07-11 07:00") OR (created > "2024-07-11 21:30" AND created < "2024-07-12 07:00") OR (created > "2024-07-12 21:30" AND created < "2024-07-14 07:00") OR (created > "2024-07-13 21:30" AND created < "2024-07-15 07:00") OR (created > "2024-07-14 21:30" AND created < "2024-07-15 07:00") OR (created > "2024-07-15 21:30" AND created < "2024-07-16 07:00") OR (created > "2024-07-16 21:30" AND created < "2024-07-17 07:00") OR (created > "2024-07-17 21:30" AND created < "2024-07-18 07:00") OR (created > "2024-07-18 21:30" AND created < "2024-07-19 07:00") OR (created > "2024-07-19 21:30" AND created < "2024-07-21 07:00") OR (created > "2024-07-20 21:30" AND created < "2024-07-22 07:00") OR (created > "2024-07-21 21:30" AND created < "2024-07-22 07:00") OR (created > "2024-07-22 21:30" AND created < "2024-07-23 07:00") OR (created > "2024-07-23 21:30" AND created < "2024-07-24 07:00") OR (created > "2024-07-24 21:30" AND created < "2024-07-25 07:00") OR (created > "2024-07-25 21:30" AND created < "2024-07-26 07:00") OR (created > "2024-07-26 21:30" AND created < "2024-07-28 07:00") OR (created > "2024-07-27 21:30" AND created < "2024-07-29 07:00") OR (created > "2024-07-28 21:30" AND created < "2024-07-29 07:00") OR (created > "2024-07-29 21:30" AND created < "2024-07-30 07:00") OR (created > "2024-07-30 21:30" AND created < "2024-07-31 07:00") OR (created > "2024-07-31 21:30" AND created < "2024-08-01 07:00")

 

1 answer

0 votes
Graham Twine
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.
July 18, 2024

Hello @Michael Church 

 

startOfDay(+8h) after 5pm today

 

This may be a good place to start.

JQL for After Hours and Weekends 

Consider the working time configured in the server

Some useful resources

search-jira-like-a-boss-with-jql 

what-is-jql 

searching-for-issues 

Basic searching
Quick searching
Advanced searching
Advanced searching - fields reference
Advanced searching - keywords reference
Advanced searching - operators reference
Advanced searching - functions reference
Search syntax for text fields
Saving your search as a filter

Working with search results

 

 

Michael Church July 18, 2024

I don't think you understand.

I'm writing a report.

When I use startOfDay(+offset), the rule only matches tickets from TODAY.  So the line is 0 all month, and only matching tickets from TODAY appear.  I would have to reconstruct the query from my postscript to use startOfDay instead of absolute values which doesn't do anything but make the window shift day-by-day.

I read that issue already, and it does not address the question.  I have also read all of the JQL docs.

Thanks anyway.

Graham Twine
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.
July 19, 2024

I think the right place to as developer related questions would be Atlassian's developer community if you are writing a plugin.


const startDay = 1; // Monday
const endDay = 5; // Friday
const startHour = 8; // 8:00 AM
const endHour = 17; // 5:00 PM

const isInsideBusinessHours = (date = new Date()) => {
const day = date.getDay();
const hour = date.getHours();
return day >= startDay && day <= endDay &&
hour >= startHour && hour < endHour;
};

One could also use the search from the REST API and use JQL

Michael Church July 20, 2024

I'm not writing a plugin.  I'm using JSM's built-in reports.

Thanks.

Suggest an answer

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

Atlassian Community Events