Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

grails 4 groovy's date enhancement methods missing

In a previous version of grails I was able to use the groovy enhanced version of java.util.Date found here here.

After upgrading to grails 4, all those methods throw no signature of method on java.util.Date. Somehow the groovy additions aren't being picked up.

  def fdate=new Date();
  out << fdate.format("MM/dd/yyyy")
  //No signature of method: java.util.Date.format()
like image 267
user2782001 Avatar asked Aug 18 '19 20:08

user2782001


1 Answers

Add a dependency to groovy-dateutil to your build.gradle:

runtime 'org.codehaus.groovy:groovy-dateutil'

The relevant extension method is defined at https://github.com/apache/groovy/blob/master/subprojects/groovy-dateutil/src/main/java/org/apache/groovy/dateutil/extensions/DateUtilExtensions.java#L526-L528, which is in the groovy-dateutil library.

like image 126
Jeff Scott Brown Avatar answered Sep 19 '22 07:09

Jeff Scott Brown