DEV Community

Kayabyte
Kayabyte

Posted on Originally published at kayabyte.dev

JQL with business days: find Jira work due within N working days

Disclosure: we (Kayabyte) make Daywise, so I'm biased; native options come first below. Written with AI assistance and checked by hand.

Short answer: Jira Cloud’s JQL has no business-day functions. Relative dates such as duedate <= 5d and functions such as endOfWeek() count calendar days, so weekends and public holidays are included. Business days in JQL have been an open request since 2010 (JRACLOUD-22506, over 350 votes). The workarounds are to over-count with calendar days, or to have Automation calculate a date and write it into a field. Daywise: Business Days & Holiday Calendars for Jira adds businessDaysFromNow() and businessDaysAgo() to JQL, with a calendar per team.

Typical searches people want:

  • Work due within the next 5 working days.
  • Requests nobody touched for 3 working days.
  • Work items that have been open for more than 10 working days.

What JQL can do natively

JQL counts in calendar time:

  • duedate <= 7d finds work due in the next 7 calendar days.
  • duedate <= endOfWeek() finds work due by the end of this week (the week start depends on your Jira settings).
  • updated <= -3d finds work not updated for 3 calendar days.

Calendar days as an approximation. Five business days are usually seven calendar days, so duedate <= 7d is close in a normal week. It is wrong around public holidays, it is wrong for teams that don’t work Monday to Friday, and the error grows with N: 10 business days is 14 calendar days only when nothing falls in between.

Workaround: let Automation calculate the date

Jira Automation knows business days (Monday to Friday, no holidays) through the plusBusinessDays and minusBusinessDays smart values. A scheduled rule can use them in its JQL and mark matching work:

  1. Trigger: Scheduled, every morning, with a JQL search such as duedate <= "{{now.plusBusinessDays(5).format("yyyy-MM-dd")}}" AND statusCategory != Done.
  2. Action: add a label such as due-5bd, or set a checkbox field.
  3. A second scheduled rule removes the label from work that no longer matches.

Then filters and boards search for labels = due-5bd. This works, but:

  • Public holidays and company closures are ignored; Automation’s business days are always Monday to Friday.
  • One rule per question (due within 5, stale for 3, open for 10), each with its own label to clean up.
  • The label is only as fresh as the last run of the rule.
  • Scheduled rules count toward your Automation usage.

Daywise: business days in JQL

Daywise is the app we make for this. It adds two JQL functions and two searchable fields, counted with a calendar per team (work week, working hours, time zone, public holidays by country and region, closures):

  • duedate <= businessDaysFromNow(5): due within five business days.
  • created <= businessDaysAgo(10): created more than ten business days ago.
  • Add a calendar name to use a specific team’s calendar: duedate <= businessDaysFromNow(5, "Oslo office").
  • Fields Business days open and Business days to due date, for example "Business days to due date" < 0 for overdue work, or "Business days open" > 10.

Things to know: the functions return a date, so they work with date fields and the operators =, !=, <, <=, > and >=. Jira keeps each function’s result, and Daywise refreshes it every hour and whenever a calendar changes. Holiday data comes from the open-source date-holidays project, and coverage varies by country, so check the preview of days off for your calendar. Daywise doesn’t change Jira Service Management SLA calendars. It runs on Atlassian Forge, makes no calls outside Atlassian, and is on the Atlassian Marketplace.

Examples

Question Native JQL (calendar days) With Daywise
Due within 5 working days duedate <= 7d (approximate) duedate <= businessDaysFromNow(5)
Overdue duedate < now() "Business days to due date" < 0
Created more than 10 working days ago created <= -14d (approximate) created <= businessDaysAgo(10)
Not updated for 3 working days updated <= -3d (counts weekends) updated <= businessDaysAgo(3)

FAQ

Does JQL have a workdays or business days function? Not in Jira Cloud. It is the open suggestion JRACLOUD-22506. Business days exist only in Automation smart values.

Why does duedate <= 5d include the weekend? Relative dates in JQL are calendar time; 5d means five calendar days from now.

Can the Automation workaround skip public holidays? No. Automation’s business days are Monday to Friday with no holiday list.

Can I use different holidays for different teams? Natively, no. With Daywise, give each team a calendar and name it in the function, or set a default calendar per project.

Jira and Atlassian are trademarks of Atlassian. Kayabyte is an independent developer and is not affiliated with or endorsed by Atlassian.

Top comments (0)