Moved date/time formatters to utils class

This commit is contained in:
Erik C. Thauvin 2023-03-21 07:21:24 -07:00
parent 05c1bd3f2a
commit 5ea5727a4a
15 changed files with 66 additions and 48 deletions

View file

@ -19,10 +19,8 @@ package rife.render;
import rife.template.Template;
import rife.template.ValueRenderer;
import rife.tools.Localization;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
/**
* <p>Return the current time in ISO 8601 format.</p>
@ -39,17 +37,11 @@ import java.time.format.DateTimeFormatter;
* @since 1.0
*/
public class TimeIso implements ValueRenderer {
/**
* ISO 8601 time formatter.
*/
static public final DateTimeFormatter iso8601Formatter =
DateTimeFormatter.ofPattern("HH:mm:ss").withLocale(Localization.getLocale());
/**
* {@inheritDoc}
*/
@Override
public String render(Template template, String valueId, String differentiator) {
return ZonedDateTime.now().format(iso8601Formatter);
return ZonedDateTime.now().format(RenderUtils.ISO_8601_TIME_FORMATTER);
}
}