JSFiddle - React, Tailwind, and code Playground
by Igaojsfiddle
HTML
<script src="http://sugarjs.com/release/current/sugar-full.min.js?20130825"></script>
<script src="http://momentjs.com/downloads/moment.min.js"></script>
<span data-bind="text: relativeTime, attr: { title: emcima }"></span>
JavaScript
var updateInterval = 60 * 1000; // update every 60 seconds
var postDate = new Date(); // supposed to be your post date
function model() {
var self = this;
this.emcima = moment().calendar();
this.relativeTime = ko.observable(Date.create(postDate).relative('pt'));
setInterval(function () {
self.relativeTime(Date.create(postDate).relative('pt'));
}, updateInterval);
}
ko.applyBindings(new model());