Open tacman opened 4 months ago
The problem with
{{ item.createdAt|time_diff }}
is that it renders HTML with the age of the item at the time of rendering.
What we want is the age of the item. This can be done by installing stimulus-timeago, and instead using
<time data-controller="timeago" data-timeago-add-suffix-value="true" data-timeago-include-seconds-value="true" data-timeago-refresh-interval-value="1000" data-timeago-datetime-value="{{ item.createdAt|date('c') }}"></time>.
That way, when it runs offline the time ago is correct. And even updated dynamically!
Add an item at
https://phpwa-demo.survos.com/
Go offline and refresh, the item age is accurate.
Indeed. It looks better and will perfectly fit in case data are loaded async
The problem with
is that it renders HTML with the age of the item at the time of rendering.
What we want is the age of the item. This can be done by installing stimulus-timeago, and instead using
That way, when it runs offline the time ago is correct. And even updated dynamically!
Add an item at
https://phpwa-demo.survos.com/
Go offline and refresh, the item age is accurate.