Closed thomas-mc-work closed 3 years ago
Thanks for reporting this issue. I'll try to reproduce it.
Hello @thomas-mc-work ,
It seems, that the Java Time Dialect has to be configured according to the add-on's installation guide within the Template-Engine.
package de.erdlet.thymeleaf_time_error;
import javax.enterprise.inject.Produces;
import javax.enterprise.inject.Specializes;
import org.eclipse.krazo.ext.thymeleaf.DefaultTemplateEngineProducer;
import org.thymeleaf.TemplateEngine;
import org.thymeleaf.extras.java8time.dialect.Java8TimeDialect;
public class ThymeleafConfiguration extends DefaultTemplateEngineProducer {
@Override
@Produces
@Specializes
public TemplateEngine getTemplateEngine() {
final TemplateEngine templateEngine = super.getTemplateEngine();
templateEngine.addDialect(new Java8TimeDialect());
return templateEngine;
}
}
I tried your example and was able to reproduce your problem without the class above. As soon as I add this configuration, my LocalDate
will be formatted to 2020-11-11T00:00:00.000+0100
.
Hope that resolves your problem.
Thank you very much for your precise and fast reply, @erdlet!
I had to add the annotation @ApplicationScoped
for the bean to be recognized. You've probably set bean-discovery-mode
to all
, did you?
Yes, you're right. I think this is default in the projects generated by our archetype.
Wouldn't it be nice to have this documented somewhere in this repository?
Wouldn't it be nice to have this documented somewhere in this repository?
Good idea, I‘ll add a few words regarding this to the docs within the next days.
I'd like to format a
LocalDate
value properly in a Thymeleaf template like this:View:
This leads to an exception:
Here the relevant
pom.xml
part:What could be the reason for that exception? Only printing the raw date is working.