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!
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.