Forums

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

How to run Jira Automation every 21 days (on a specific weekday) — Data Center solution

I ran into a surprisingly tricky problem recently:
I had a request to run a Jira Automation rule every 21 days, but only on Tuesday.

Sounds simple, right? Yeah… It’s not.

The problem is that cron can easily do:

  • every Tuesday 

  • every X days 

But combining both, it can't :D 

every 21 days and on Tuesday

 

I tried the usual approaches, but the result was empty values or errors.

  • now.diff("date")

  • toDate() parsing

  • different smart value tricks

Instead of fighting date parsing, I switched to something much simpler: treat dates as numbers

Jira has this handy smart value for that.

{{now.toDays}}

It converts today into a number. So instead of working with dates, we just do math.

My Final setup was the following.

Trigger

  • Scheduled

  • Every Tuesday (e.g., 09:00)

Compare Condition

{{#=}}({{now.toDays}} - 20522) % 21{{/}}

equals

0

What is 20522?

That’s just your starting point.

In my case:

2026-03-10 (Tuesday) → 20522

So when Jira runs:

Today (for example 2026-03-31) → 20543

20543 - 20522 = 21

21 % 21 = 0 

That’s why the rule runs exactly every 3 weeks.

When Modulo = 0 → your rule will execute.

So hopefully this saves someone else a few hours 😄

If you’ve solved this differently, I’d be curious to hear your approach 👇

2 comments

Виталий Баранов
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 5, 2026

This is a great breakdown of the problem, and your solution is surprisingly elegant. Jira Automation really does struggle with scenarios where you need both a fixed weekday and a fixed interval in days. As you pointed out, cron can handle each requirement individually, but combining them isn’t supported — which makes “every 21 days, but only on Tuesday” trickier than it sounds.

Your approach of switching from date parsing to simple arithmetic using {{now.toDays}} is a smart workaround. Jira’s date functions often return empty values or errors when formats don’t match exactly, so avoiding toDate(), diff(), and other parsing logic is a huge advantage.

By converting dates into integers, you essentially created a clean, deterministic cycle:

  • Pick a known starting Tuesday

  • Convert it to toDays

  • Subtract it from today’s toDays

  • Check if the remainder modulo 21 is zero

This turns the entire problem into a simple math check, which is far more reliable than trying to force Jira to interpret dates correctly.

Why this method works so well

  • {{now.toDays}} increases by exactly 1 every day

  • No timezone issues

  • No date formatting issues

  • No need to store previous run dates

  • Works for any interval (21, 28, 35 days, etc.)

  • Works with any weekday trigger

It’s also easy to maintain — anyone looking at the rule can immediately understand the logic once they know what the starting number represents.

Alternative approaches

There are other ways to solve this, but they’re usually more fragile:

  • Storing the last run date in a custom field and comparing it

  • Using now.diff() with strict date formatting

  • Running every day and checking weekday + diff

  • Using webhooks or external schedulers

All of these introduce more complexity than necessary. Your modulo‑based solution is cleaner and more robust.

Conclusion

This is a clever and practical workaround for a limitation in Jira Automation. Treating dates as numbers avoids the usual parsing pitfalls and gives you a predictable 21‑day cycle aligned to a specific weekday. I’m sure this will save others a lot of time — thanks for sharing it.

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 Champions.
April 5, 2026

Hi @Виталий Баранов 

What is the source of the content you posted?

As a reminder, posting completely bot / AI-generated content is not permitted in this community.  And when such tools are used to modify content for a post, the sources are to be described in the text.  To learn more, please carefully review the community rules of engagement / guidelines:

https://community.atlassian.com/forums/custom/page/page-id/rules-of-engagement

Kind regards,
Bill

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events