public class StyleDateConverter extends DateConverter
This converter is especially suited on a per-component base.
DateTextField
,
DateTime
,
DateTimeFormat
,
DateTimeZone
,
Serialized FormConstructor and Description |
---|
StyleDateConverter(boolean applyTimeZoneDifference)
Construct.
|
StyleDateConverter(String dateStyle,
boolean applyTimeZoneDifference)
Construct.
|
Modifier and Type | Method and Description |
---|---|
String |
getDatePattern(Locale locale)
Gets the optional date pattern.
|
protected org.joda.time.format.DateTimeFormatter |
getFormat(Locale locale) |
convertToObject, convertToString, getApplyTimeZoneDifference, getClientTimeZone, getTimeZone
public StyleDateConverter(boolean applyTimeZoneDifference)
DateTimeFormat.shortDate()
) will
be used for constructing the date format for the current locale. When
applyTimeZoneDifference is true, the current time is applied on the parsed date, and the date
will be corrected for the time zone difference between the server and the client. For
instance, if I'm in Seattle and the server I'm working on is in Amsterdam, the server is 9
hours ahead. So, if I'm inputting say 12/24 at a couple of hours before midnight, at the
server it is already 12/25. If this boolean is true, it will be transformed to 12/25, while
the client sees 12/24. applyTimeZoneDifference
- whether to apply the difference in time zones between client and serverpublic StyleDateConverter(String dateStyle, boolean applyTimeZoneDifference)
DateTimeFormat.shortDate()
will be used.
When applyTimeZoneDifference is true, the current time is applied on the parsed date, and the
date will be corrected for the time zone difference between the server and the client. For
instance, if I'm in Seattle and the server I'm working on is in Amsterdam, the server is 9
hours ahead. So, if I'm inputting say 12/24 at a couple of hours before midnight, at the
server it is already 12/25. If this boolean is true, it will be transformed to 12/25, while
the client sees 12/24. dateStyle
- Date style to use. The first character is the date style, and the second character
is the time style. Specify a character of 'S' for short style, 'M' for medium, 'L'
for long, and 'F' for full. A date or time may be ommitted by specifying a style
character '-'. See DateTimeFormat.forStyle(String)
.applyTimeZoneDifference
- whether to apply the difference in time zones between client and serverIllegalArgumentException
- in case dateStyle is nullpublic final String getDatePattern(Locale locale)
getDatePattern
in class DateConverter
locale
- The locale used to convert the valueprotected org.joda.time.format.DateTimeFormatter getFormat(Locale locale)
getFormat
in class DateConverter
locale
- The locale used to convert the valueCopyright © 2006–2021 Apache Software Foundation. All rights reserved.