event.eventStart is an OffsetDateTime object.

Added to POM

<dependency>
            <groupId>org.thymeleaf.extras</groupId>
            <artifactId>thymeleaf-extras-java8time</artifactId>
            <version>3.0.4.RELEASE</version>
</dependency>

Added Java8TimeDialect to TemplateEngine

 final SpringTemplateEngine templateEngine = new SpringTemplateEngine();
        templateEngine.addDialect(new Java8TimeDialect());

Expected - This Row Shows Formatted Time in my Email.

<span th:text="${#temporals.format( ${event.eventStart} , 'yyyy-MM-dd HH:mm:ss ZZZZ')}"></span>

Actual -

Expression [#temporals.format( ${event.eventStart} , 'yyyy-MM-dd HH:mm:ss ZZZZ')] @20: EL1043E: Unexpected token. Expected 'rparen())' but was 'lcurly({)'

1

There are 1 answers

1
Metroids On

You can't nest ${...} expressions. Just remove the extra one you have in the middle. For example:

th:text="${#temporals.format(event.eventStart, 'yyyy-MM-dd HH:mm:ss ZZZZ')}"