flow-components icon indicating copy to clipboard operation
flow-components copied to clipboard

Flow: MessageList::setTimeFormatter

Open pekam opened this issue 5 years ago • 2 comments

Add the following methods:

class MessageList {
  void setTimeFormatter(SerializableFunction<Instant, String> timeFormatter)
  SerializableFunction<Instant, String> getTimeFormatter()
}

The timeFormatter should be used for the time property in MessageListItem objects when converting to the client-side items array.

If the list already has items when calling the setter, the items array should be generated again.

pekam avatar Feb 04 '21 15:02 pekam

We decided to implement the default formatting by using client-side code, so that we can provide the best possible default behavior by using the user's browser's time zone: vaadin/vaadin-messages#25.

It needs to be re-evaluated if we want to provide this API that converts the times to strings at server-side, since the default behavior can't be achieved with that.

pekam avatar Feb 10 '21 15:02 pekam

I think the main issue is that there should be a way to customise the formatting of the timestamp. If not in the backend, then how to customise it in the client-side code? E.g. I would like to display the seconds as well.

diversit avatar May 23 '24 07:05 diversit