0

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?

MKB
  • 7,587
  • 9
  • 45
  • 71

2 Answers2

0

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.

Jeff Scott Brown
  • 26,804
  • 2
  • 30
  • 47
0

Workaround --

Get milliseconds from java.sql.Date class instance and pass that in the taglib.

g.formatDate(date: date.getTime(), format: 'yyyy/MM/dd')
MKB
  • 7,587
  • 9
  • 45
  • 71