I have a Grails 3.1.2 application
One of my domain classes is Goal
import java.time.LocalDateTime
import java.time.temporal.ChronoUnit
class Goal {
String name
String description
LocalDateTime targetDate
Date dateCreated
Date lastUpdated
static constraints = {
name(nullable: false, blank: false)
}
}
When I call validate on my an instance of Goal I get:
- Field error in object 'com.liftyourgame.model.Goal' on field 'targetDate': rejected value [2016-01-28T15:10:39.000Z]; codes [com.liftyourgame.model.Goal.targetDate.typeMismatch.error,com.liftyourgame.model.Goal.targetDate.typeMismatch,goal.targetDate.typeMismatch.error,goal.targetDate.typeMismatch,typeMismatch.com.liftyourgame.model.Goal.targetDate,typeMismatch.targetDate,typeMismatch.java.time.LocalDateTime,typeMismatch]; arguments [targetDate]; default message [Could not find matching constructor for: java.time.LocalDateTime(java.lang.String)]
How can I change the validation so it doesn't need this constructor?