Search code examples
grailsgroovygrails-plugingspgrails-4

g:formatDate issue with java.sql.Date class instances


Java 7 - java.sql.Date - uses toInstant method of java.util.Date class.

Java 8 - java.sql.Date - Overrides toInstant method and now throws UnsupportedOperationException exception.

grails-gsp-plugin v3.3.2 - DefaultGrailsTagDateHelper - able to format java.sql.Date class instance.

grails-gsp-plugin v4.0.0 - DefaultGrailsTagDateHelper - not able to foramt java.sql.Date class instance because date.toInstant() is thowing UnsupportedOperationException (expected as per java 8 code).

And as per the docs Grails 4 is no longer compatible with Java 1.7.

So now is it expected that g.formatDate not allowing java.sql.Date class instance? Or is it a bug in the plugin?


Solution

  • I think this change was introduced at https://github.com/grails/grails-gsp/commit/20e6ad461b575642263e4689de9cb1c7f33d1a7b. If you file a report at https://github.com/grails/grails-gsp/issues we can investigate.

    Thanks for the feedback.