I am trying to compare two dates to each other
- Current date/time
- FixVersion start date +16 hours
How I am doing this is:
//To get the actual DATE
def today = new Date().format('yyyy-MM-dd hh:mm:ss')
//To define the Done DATE and TIME
def done = issue.get("fixVersions").startDate.toString()
if ((today) < (done)) {
true
}
else{false}
This technically works to compare the dates, but if I want to add time to the FixVersion start date, I need to convert the string to a date object. I have tried to do that by changing the code to:
//To define the done DATE and TIME
def done = issue.get("fixVersions").startDate.toString()
def doneDate = new Date().parse("yyyy-MM-dd hh:mm:ss", done)
However, this fails with the following error:
Message:
java.text.ParseException: Unparseable date: "[2021-02-28 00:00:00.0]"
Any idea what I'm doing wrong here?