Forums

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

Compare 2 field Date Picker Value using JMWE

NORBERTUS WUSANA
Contributor
September 28, 2024

Hi All,

Please give me an advice to solve my iquiry below. I have the destination field namely: Date Marks

The Date Marks will be automatically filled by JMWE post function with this matrix:

  • Date Marks will be On Time when: Date A before Date B OR Date B before Current Date
  • Date Marks will be Need Attention when: Date B after Current Date (in the same month)
  • Date Marks will be Late when: Date B after Current Date (starting next month/different month)

Thank you :)

1 answer

1 vote
David Fischer
Community Champion
September 29, 2024

Hi @NORBERTUS WUSANA 

You can use a Set Issue Fields post function, and use this expression value:

{% if (issue.fields["Date A"] | date("diff", issue.fields["Date B"])) < 0 or (now | date("diff", issue.fields["Date B"])) >= 0 %}

On time

{% elif (now | date("diff", issue.fields["Date B"])) < 0 and now | date("startOf", "month") == issue.fields["Date B"] | date("startOf", "month") %}

Needs attention

{% else %}

Late

{% endif %}

NORBERTUS WUSANA
Contributor
September 29, 2024

Thank you @David Fischer , it helps a lot.

I need to revise my logic, and the updated as followed:

  • Date Marks will be On Time when: (Date A is not empty and the value is before or same with Date B) OR (Date A is empty AND Date B after or same with Current Date)

 

  • Date Marks will be Need Attention when: Date A is empty AND Date B before Current Date (Note: Date B in the same month with current date)

 

  • Date Marks will be Late when: Date A is empty AND Date B before Current Date (Note: Date B in month before/different month with current date)

 

Thank you in advance David!

David Fischer
Community Champion
September 30, 2024

Hi @NORBERTUS WUSANA 

try this:

{% if issue.fields["Date A"] and (issue.fields["Date A"] | date("diff", issue.fields["Date B"])) <= 0 or not issue.fields["Date A"] and (now | date("diff", issue.fields["Date B"])) <= 0 %}
On time
{% elif not issue.fields["Date A"] and (now | date("diff", issue.fields["Date B"])) > 0 and now | date("startOf", "month") == issue.fields["Date B"] | date("startOf", "month") %}
Needs attention
{% else %}
Late
{% endif %}

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