Vaadin Grid column renderers to display java.time types: Instant
, OffsetDateTime
, and ZonedDateTime
Time Column Renderers is a non-visual component add-on for Vaadin Framework 8.1 and later for displaying additional java.time types.
Vaadin Grid 8.1 and later comes bundled with a pair of column renderers for displaying two of the modern date-time data types found in Java 8 and later:
LocalDateRenderer
for displayingLocalDate
objectsLocalDateTimeRenderer
for displayingLocalDateTime
objects.
These two java.time types purposely lack any concept of time zone or offset-from-UTC.
The java.time classes include three more types that do include a time zone or offset-from-UTC:
By default, Vaadin Grid calls the toString
method on such objects to render a String for display. That toString
method generates a string in standard ISO 8601 format such as 2017-01-23T01:23:45.678Z
. To display the date-time values in other formats, use this add-on with its trio of column renderers appropriately named: InstantRenderer
, OffsetDateTimeRenderer
, and ZonedDateTimeRenderer
. Specify a DateTimeFormatter
with ZoneId
and Locale
to adjust zones and localize.
The API of these renderer classes follows the pattern of the API of the classes published by Vaadin Ltd. Note that I do not agree with their decision to provide constructors taking a String representing a custom formatting pattern. Other constructors take a DateTimeFormatter
object, and that should suffice. The column renderers should not, in my opinion, get involved in processing a calling programmer’s custom formatting pattern codes. And these extra constructors complicate the API of these classes with no added benefit. See my feature request # 10,207 to remove these constructors from their API. If deprecated there, I will do so here.
Hopefully, such classes as these renderers will be added to Vaadin itself in a future update. See feature request # 10,208.
Install
Initial release to the public. Considered stable by me for my own work.