Search code examples
jirajqljira-agile

JIRA JQL: Get all tasks due on, or before, the closest future Wednesday


How do I create a JQL query, for a JIRA Agile swimlane, that displays all tasks due on the closest Wednesday in the future. For example, today is Monday and I want to see all tasks due on Wednesday (in two days). If today is Thursday, I want to see all tasks due on Wednesday next week.

One solution I have found it to use the following query, but it forces the due date to always be set on a Wednesday:

duedate <= 6d

I have also tried something with endOfWeek, but is only works in my Monday example and not in my Thursday example.

duedate <= endOfWeek(-3d)

Solution

  • I think it is not possible just with JQL. Can you use scripts? or plugins? do you have scriptrunner plugin installed??

    • If you can get scriptrunner: there is a feature, Scripted field: you could add a scripted field always hidden wich calculate the next wednesday. So then you JQL could be just duedate<=wednesday

    • If not your best choice would be use two querys. One for days before wednesdays, and another one for days after

    For days before wednesday:

    duedate <= startOfWeek(3d) and duedate > startOfWeek()
    

    For days after wednesday:

    duedate <= startOfWeek(10d) and duedate > startOfWeek(7d)
    

    Sadly i cant test it properly, but it should work (if your country locale is USA based as i guess due to your profile :) )

    Regards.