I'm trying to use a JWT expression validator to check that the issue is created on or after March 1st, 2024.
When entering the text ..... issue?.created.toCalendarDate() >= "2024-03-04"
I get the error.... Jira expression evaluation failed: ["Evaluation failed: \"issue?.created.toCalendarDate() > \"2024-03-04\"\" - operator \">\" is not applicable to types: CalendarDate and String"]
This is frustrating as the documentation lists regular operators, such as >=, as valid operators for Date and Calendar Date data types so I'm not sure where I've gone wrong.
NOTE: I understand I could simply use the date comparison validator to compare the dates, however I intend to add additional logic to my query which necessitates the JWT Expression Validator.
Any insight on how to correctly write this validation would be greatly appreciated.
Hi @McCluskey_ James ,
While the operator is generally valid, the problem is that you're comparing different types - a CalendarDate with a String ("2024-03-04").
Are you actually planning to compare with a hard-coded timestamp, or are you going to use a relative expression, e.g.
issue?.created > new Date().minusMonths(1)
will return true if the issue has been created within the last month.
Edit:
For the hard-coded way, please try
issue?.created.toCalendarDate() >= new CalendarDate("2024-03-04")
Cheers,
Thorsten
Thank you much for explaining why it was failing as well as the expression! Works like a charm.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Glad to hear! Just let me know if you need further help with adding the additional logic.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.