Class DateFormatter<V>
java.lang.Object
io.jmix.flowui.component.formatter.DateFormatter<V>
@Component("flowui_DateFormatter")
@Scope("prototype")
public class DateFormatter<V>
extends Object
implements Formatter<V>
DateFormatter formatter to be used in view descriptors and controllers.
This formatter formats the DateFormatter value into a string depending on the format string.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CurrentAuthenticationprotected DateTimeTransformationsprotected Stringprotected FormatStringsRegistryprotected Messagesprotected Stringprotected boolean -
Constructor Summary
ConstructorsConstructorDescriptionDateFormatter(CurrentAuthentication currentAuthentication, Messages messages, FormatStringsRegistry formatStringsRegistry, DateTimeTransformations dateTimeTransformations) -
Method Summary
Modifier and TypeMethodDescriptionFormats a value to a string.protected StringapplyFormatInternal(V value) voidSets the format string describing the date format which will be used to createSimpleDateFormatinstance.voidSets the formatter type, which can have aDATEorDATETIMEvalue.voidsetUseUserTimezone(boolean useUserTimezone) Sets whether formatter should display the date and time in the current user's timezone.
-
Field Details
-
currentAuthentication
-
messages
-
formatStringsRegistry
-
dateTimeTransformations
-
format
-
type
-
useUserTimezone
protected boolean useUserTimezone
-
-
Constructor Details
-
DateFormatter
public DateFormatter(CurrentAuthentication currentAuthentication, Messages messages, FormatStringsRegistry formatStringsRegistry, DateTimeTransformations dateTimeTransformations)
-
-
Method Details
-
setFormat
Sets the format string describing the date format which will be used to createSimpleDateFormatinstance. It can be either a format string, or a key in message group.- Parameters:
format- a format string or a key in message group
-
setType
Sets the formatter type, which can have aDATEorDATETIMEvalue. If specified, the value will be formatted by means ofDateDatatypeorDateTimeDatatyperespectively.- Parameters:
type- a formatter type
-
setUseUserTimezone
public void setUseUserTimezone(boolean useUserTimezone) Sets whether formatter should display the date and time in the current user's timezone.- Parameters:
useUserTimezone-trueif the formatter displays the date and time in the current user's timezone,falseotherwise
-
apply
Description copied from interface:FormatterFormats a value to a string. -
applyFormatInternal
-