Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Compare custom field dates in behaviour ? Edited

I am desperately trying to compare 2 dates from custom fields in the issue screen, but nothing happens and I can't find the problem in my code:

-------------------------------------------------------------------------
def StartDateField = getFieldByName("Start date")


def EndDateField = getFieldByName("End date")

 


Date StartDateValue = (StartDateField.value as Date)
Date EndDateValue = (EndDateField.value as Date)


if ( StartDateValue.getTime() > EndDateValue.getTime() ) {

 EndDateField.setError("EndDateValue cannot be earlier than StartDateValue")
} else {

EndDateField.clearError()
}

-----------------------------------------------------------------------

Your help will be much appreciated!

1 answer

Convert the both date in yyyymmddmmss and compare it.

covert like 201912191530 and 201912180930 and compare.

how to convert ?  after convert , Is it compared as a string?

thanks

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you