how to compare a date with current date in groovy

grails, groovy

Solution

It's

Date now = new Date()
if (validFrom.before(now) && validTo.after(now)) {
  //valid for this moment
}

Problem

I have a validFrom and validTo date field in my domain class in grails project. I want to create a service on the basis of its validation. can anyone pls tell me how to check if it is greater or lesser than current system date?

Original source