Moved date/time formatters to utils class
This commit is contained in:
parent
05c1bd3f2a
commit
5ea5727a4a
15 changed files with 66 additions and 48 deletions
|
@ -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 date and time in RFC 2822 format.</p>
|
||||
|
@ -39,17 +37,11 @@ import java.time.format.DateTimeFormatter;
|
|||
* @since 1.0
|
||||
*/
|
||||
public class DateTimeRfc2822 implements ValueRenderer {
|
||||
/**
|
||||
* RFC 2822 date and time formatter.
|
||||
*/
|
||||
static public final DateTimeFormatter rfc2822Formatter =
|
||||
DateTimeFormatter.ofPattern("EEE, d MMM yyyy HH:mm:ss zzz").withLocale(Localization.getLocale());
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String render(Template template, String valueId, String differentiator) {
|
||||
return ZonedDateTime.now().format(rfc2822Formatter);
|
||||
return ZonedDateTime.now().format(RenderUtils.RFC_2822_FORMATTER);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue