Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Automation for Jira: syntax for "Is today between two dates"?


I'm trying to write a rule that triggers when an Issue transitions to a certain status, with a condition that includes if-else blocks.  I'm stuck on the correct magic for the date logic in the condition, which looks like:

  • if today is between two dates --> set a field value to XX
  • if today is between two other dates  --> set a field value to YY
  • etc...

So if {{ now.isAfter("2019-12-01") }} is true, and if {{ now.isBefore("2020-02-28") }} then set field to XXX

When the rule triggers, the {{ now.isAfter("2019-12-01") }}, it tells me that the Issue did not match the condition.  

Does anyone know how to get that expression can resolve to true?  Tried using .toDate, .jiraDate, and a bunch of other things, to no avail.

thanks in advance!


1 answer

Hi. I was trying to do the exact same thing. The smart value expression you posted (`now.isAfter("2020-05-10")`) actually gives a blank result, which is weird. Using toDate and the rest gave me errors.

There's an unwieldy expression that does work:

{{ now.isAfter(now.withYear(2020).withMonth(5).withDayOfMonth(10)) }}

This gives the desired result, but I think it's a bit of a hack, I'd think there's a less ugly way to do this.

Oh and: I posted this as a question on StackOverflow:

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Apps & Integrations

🍻🍂Apptoberfest Update: Upcoming Virtual Events 🎉

Hello Community! I hope you've been enjoying the 🍂Apptoberfestivities🍂 (I know I have!) The event is heating up next week with a series of virtual events that we're calling the 🍻🍂Partner App ...

332 views 3 14
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you