Thymeleaf Joda Dialect

Adds Joda utility methods to Thymeleaf templates

License

License

Categories

Categories

Net Leaf Data Databases
GroupId

GroupId

nz.net.ultraq.thymeleaf
ArtifactId

ArtifactId

thymeleaf-joda-dialect
Last Version

Last Version

2.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

Thymeleaf Joda Dialect
Adds Joda utility methods to Thymeleaf templates
Project URL

Project URL

http://www.ultraq.net.nz/programming/thymeleaf-joda-dialect/
Source Code Management

Source Code Management

https://github.com/ultraq/thymeleaf-joda-dialect

Download thymeleaf-joda-dialect

How to add to project

<!-- https://jarcasting.com/artifacts/nz.net.ultraq.thymeleaf/thymeleaf-joda-dialect/ -->
<dependency>
    <groupId>nz.net.ultraq.thymeleaf</groupId>
    <artifactId>thymeleaf-joda-dialect</artifactId>
    <version>2.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/nz.net.ultraq.thymeleaf/thymeleaf-joda-dialect/
implementation 'nz.net.ultraq.thymeleaf:thymeleaf-joda-dialect:2.0.0'
// https://jarcasting.com/artifacts/nz.net.ultraq.thymeleaf/thymeleaf-joda-dialect/
implementation ("nz.net.ultraq.thymeleaf:thymeleaf-joda-dialect:2.0.0")
'nz.net.ultraq.thymeleaf:thymeleaf-joda-dialect:jar:2.0.0'
<dependency org="nz.net.ultraq.thymeleaf" name="thymeleaf-joda-dialect" rev="2.0.0">
  <artifact name="thymeleaf-joda-dialect" type="jar" />
</dependency>
@Grapes(
@Grab(group='nz.net.ultraq.thymeleaf', module='thymeleaf-joda-dialect', version='2.0.0')
)
libraryDependencies += "nz.net.ultraq.thymeleaf" % "thymeleaf-joda-dialect" % "2.0.0"
[nz.net.ultraq.thymeleaf/thymeleaf-joda-dialect "2.0.0"]

Dependencies

compile (3)

Group / Artifact Type Version
org.codehaus.groovy : groovy jar 2.4.6
joda-time : joda-time jar 2.9.2
org.thymeleaf : thymeleaf jar 3.0.0.RELEASE

test (1)

Group / Artifact Type Version
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

Thymeleaf Joda Dialect

Build Status Coverage Status GitHub Release Maven Central License

A dialect for Thymeleaf that adds Joda utility methods to Thymeleaf templates.

Installation

Minimum of Java 7 and Thymeleaf 3.0 required. For Thymeleaf 2.1, check out the 1.x releases.

Standalone distribution

Copy the JAR from one of the release bundles, placing it in the classpath of your program, or build the project from the source code here on GitHub.

For Maven and Maven-compatible dependency managers

Add a dependency to your project with the following co-ordinates:

  • GroupId: nz.net.ultraq.thymeleaf
  • ArtifactId: thymeleaf-joda-dialect
  • Version: (as per the badges above)

Usage

Add the Joda dialect to your existing Thymeleaf template engine, eg:

Java example:

templateEngine.addDialect(new JodaDialect());

Spring XML configuration example:

<bean id="templateEngine" class="org.thymeleaf.spring3.SpringTemplateEngine">
  ...
  <property name="additionalDialects">
    <set>
      <bean class="nz.net.ultraq.thymeleaf.JodaDialect"/>
    </set>
  </property>
</bean>

This will introduce the joda expression object to your Thymeleaf templates, adding 2 new utility methods you can use in your pages: createNow, and format.

createNow

Creates a new Joda DateTime instance whose time is the instant at which the method was called.

<div th:with="now=${#joda.createNow()}">...</div>

format

Formats a Joda DateTime instance according to the given format string. Documentation on the format string can be found on Joda's API pages here, although it's mostly compatible with the JDK date patterns that all Java devs know already.

<div th:text="${#joda.format(myDate, 'EEEE, d MMMM yyyy')}">...</div>

Versions

Version
2.0.0
1.0.2
1.0.1
1.0.0