Nice add-on, I have built it at least once before for a project

Very nice to have a solid implementation now available as a library :+1: Using this heavyly now in one recent temperature dashboard app that I built. With no-parameter constructor I’d expect it to use Instant.now(), instead of rendering nothing (I first thought the add-on was not working).

2 Likes

Thanks Matti, glad it’s useful in a real app.

The empty rendering comes from the upstream element, which renders nothing without a datetime attribute, so the wrapper inherits that. But the fact that it read as not working is fair feedback, and the README doesn’t mention it at all.

Opened Should the no-parameter constructor default to Instant.now()? · Issue #3 · FlowingCode/RelativeTime · GitHub to decide on the default and to fix the docs either way.

1 Like

This is awesome!
I have a admin section in my app which displays the time stamp to indicate which job was run when and it’s status
I am definitely using this.
Thanks @paola.debartolo

Another use case I can think of is the MessageList
Unfortunately the current implementation of the MessageListItem offers very little scope for direct customisation.
Something like item.setTimestampComponent(new RelativeTime(instantTime).setFormatStyle(FormatStyle.LONG)) would have been very useful.

1 Like

There is a ticket about adding relative timestamps to MessageList / Message: vaadin-message-list relative time · Issue #2060 · vaadin/web-components · GitHub

You can give a :+1: to it (to the topmost “comment”) to indicate interest.

More message customizability options are probably coming soon as well.

2 Likes