One of my students has a page that displays createdAt date using moment.js in “time ago” format. Because the createdAt date does not change, the display does not change. So “25 minutes ago” remains “25 minutes ago” even when it’s 45 minutes ago.
What is the best practice for updating this? My first thought was to create a computed property called timego (perhaps on the controller) and another called “checked” and set to true or false. In it I’d use moment to set the timeago text. Then I might use a timeout to alternately toggle the “checked” property back and forth between true and false, say once a minute.
That way the computed property would see the change in the checked property and update the view even though the createdAt property remains the same.
Is there a better way to do this? Maybe by causing the computed property to recalculate directly?