Block the insertion of date before the current one

Fabio Manzoni April 6, 2018

Hi everyone,

Is possible to block the insertion of date before the current one?

For example: Today is 04/06/2018 and the user tries to put 04/05/2018. The jira should show that the date before the current date is not allowed.

Thanks,

Fabio.

1 answer

0 votes
Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 6, 2018

Hello @Fabio Manzoni

You can implement a check in the "validation" phase. If the user is entering the date on the create screen then you can add a check in the "validation" phase of the workflow transition that the date should not be less than the current date.

Fabio Manzoni April 6, 2018

Tarun, 

Thanks for answer. 

Do you have an example code?

Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 6, 2018

Out of the box you can't have it, I use the script runner plugin for implementing such features.

Samples here

https://scriptrunner.adaptavist.com/latest/jira/recipes/workflow/validators/simple-scripted-validators.html

You can easily get the value of the date using customFieldManager then convert the value to an Date object and then compare it with today's date.

How to work with dates in groovy 

http://mrhaki.blogspot.nl/2009/08/groovy-goodness-working-with-dates.html

Suggest an answer

Log in or Sign up to answer