Forums

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

Compare two Date Picker fields - JMWE - Validator

RIZKY JTUASIKAL
Contributor
June 14, 2023

I have two field, both of them are Date Picker type fields.

example:

1. Date X

2. Date Y

 

 

If you select June 15th for the Date X field, and you select June 12th for the Date Y field, an error will occur. (cannot do the backdated process).

How to achieve that?

 

 

2 answers

2 accepted

0 votes
Answer accepted
Avinash Bhagawati {Appfire}
Community Champion
June 14, 2023

Hi @RIZKY JTUASIKAL ,

As per the the attached tags to the post, you would to achieve your requirement using JMWE then you can use "Scripted validator"  with below sample code.

https://appfire.atlassian.net/wiki/spaces/_/pages/78480377?atlOrigin=eyJpIjoiMzkzYmYyZjBjZGY3NDc5NWIyOTNlYzRkZWFhMjEyNDQiLCJwIjoiYyJ9 

!! issue.customfield_10183 && !! issue.customfield_10184 && ( new CalendarDate(issue.customfield_10184) > new CalendarDate(issue.customfield_10183))

In above customfield_10183 and customfield_10184 refers to Date X and Date Y respectively.

Please note that above code fulfils with two validations, i.e both Date X and Date Y are required fields and Date Y > Date X.

Additionally, you can use built in/native  "Date Compare validator" compare Date X and Date Y.

Thanks,
Avinash

RIZKY JTUASIKAL
Contributor
June 15, 2023

Hi @Avinash Bhagawati {Appfire} ,

 

thank you very much for helping me. I dearly appreciate it :)

0 votes
Answer accepted
Tansu Akdeniz
Community Champion
June 14, 2023

Hi @RIZKY JTUASIKAL 

Go to

  • Project settings -> workflows and edit the workflow.
  • Find Create transition and click validators.
  • Add Validator -> Date Compare Validator and compare date fields.
RIZKY JTUASIKAL
Contributor
June 15, 2023

Hi @Tansu Akdeniz ,

 

this method also works well!

thank you so much

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events