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()
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With