thymeleaf / thymeleaf-extras-java8time

Thymeleaf "extras" dialect for formatting and creating Java 8 Time API objects
Apache License 2.0
105 stars 34 forks source link

Formatting of java.time.LocalTime does not work #2

Closed cplaetzinger closed 9 years ago

cplaetzinger commented 9 years ago

I'm trying to format an instance of type java.time.LocalTime

${#temporals.format(localTime)}

This leads to the following exception:

Caused by: java.lang.IllegalArgumentException: Cannot format object of class "java.time.LocalTime" as a date
    at org.thymeleaf.extras.java8time.util.TemporalFormattingUtils.zonedTime(TemporalFormattingUtils.java:183)
    at org.thymeleaf.extras.java8time.util.TemporalFormattingUtils.formatDate(TemporalFormattingUtils.java:161)
jmiguelsamper commented 9 years ago

Hi Christian,

I'm afraid you're right. We will publish a fix ASAP.

Thanks

cplaetzinger commented 9 years ago

Thanks for your fast reply. Was not sure if I use it in a proper way.

jmiguelsamper commented 9 years ago

As a temporary workaround, it will work if you supply a pattern as a second argument.

jmiguelsamper commented 9 years ago

This is fixed in 2.1.1-SNAPSHOT (see http://www.thymeleaf.org/faq.html#use-snapshot) but please be aware of issue #3