Knockout + Moment.js – Update relative dates inside an observable
Inside my list of completed tasks, I used Moment.js's fromNow() to list
the relative date of completion for each task. Here's the task model:
Task.Model = function(data) {
this.id = data.id;
this.title = ko.observable(data.title);
this.status = ko.observable(data.status);
this.completed = ko.observable(moment(data.date_completed).fromNow());
};
The relative date shows up, but the minutes never update, unless I
refresh. Is there any way to update that observable?
No comments:
Post a Comment