Date Comparion in Universal Condition

I have a Date Picker field in a form called Start Date. I am trying to create a condition in a workflow that checks that this date is greater or equal to today. I am trying to do this with the Universal Condition of the JIRA Workflow Enhancer plugin but as the Date Picker defaults the time to 00:00:00 a Start Date of today is actually midnight last night. So the boolean equation:

"{Date Due} >= [now]" will actually be False as [now], a default variable in the Universal Condition plugin, includes the time which is obviously greater than 00:00:00.

I have tried to use "{Date Due} >= [now] - 1d" which sounds to me like it should work, but doesn't and always returns False. How can I get a condition which allows for a date picker set to today, regardless of time, to return True when compared to the [now].

Just for information I have also tried things like "[now] - {Date Due} <= 1min", "{Date Due} + 1d >= [now]", "{Date Due} >= [now] - 1d" etc. but nothing seems to work!

If the Universal Condition isn't a possibility, does anyone have any other ideas as to how to achieve this? Remember that I am using a date picker only, NOT a date and time picker (for good reason).

Many thanks.


2 answers

0 vote
Timothy Chin Community Champion May 14, 2013

Not sure of this add-on that you are using but you can use this add-on instead.

import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.Issue
import org.apache.log4j.Category

passesCondition = false;
Date date = issue.getCreatedDate();
Date now = new Date();
// Do date comparison

return passesCondition;

Hi Timothy,

Thanks for this. Would be good to try this out. However, i have failed at the first hurdle. I have searched for script runner in the Universal Plugin Manager as the help on your site suggests but I cannot see your plugin appear. What is its actual name? There is one called Jira Scripting Suite. Is it this one?

Many thanks


Hi Timothy,

Thanks for this. I am trying to give it a go. Had this plugin installed already actually, just never really used it so not really sure what I am doing with the programming elements! Anyway, I have tried this script:

import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.Issue
import org.apache.log4j.Category

passesCondition = true;
Date dateDateDue = $issue.getCustomFieldValue("customfield_10080");
Date dateNow = new Date();

// Do date comparison
#if (dateDateDue < dateNow)
passesCondition = false;
invalidInputException = new InvalidInputException("Date Due cannot be in the passed.")

return passesCondition;

My date field that I am wanting to compare to today is a custom field "Date Picker" with ID 10080. However, this, when saved in a file C:\Program Files\Atlassian\JIRA\atlassian-jira\JavaScriptFiles\ValidateDateDueScript.groovy and referenced in the "Script Validator" file path property of a workflow validator, gives the following error when I try to transition a ticket via this workflow:

"An unknown exception occured executing Validator com.onresolve.jira.groovy.GroovyValidator@4ac5b7: root cause: java.lang.NullPointerException"

What might I be doing wrong?

Many many thanks.


Hi Timothy,

I was wondering if you would have chance to comment on the above? I would really appreciate it. I am sure this is something really simple, but the programming side of Jira is not something I am familiar with.

Many thanks for any help you can offer.

Take care


Or use JJupin if you want to do it easily:

Code should look like:

return startOfDay(customfield_10101) &gt; startOfDay(dueDate); //or whatever

Hi Radu,

Thanks for your response. The plugin that you mention is a costable plugin, and whilst it is not that expensive I was hoping to achieve this without any cost at all. Thanks again.


Sure, I can understand that.

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,203 views 13 19
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot