JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://code.jquery.com/jquery-2.0.0.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/moment.js/1.7.2/moment.min.js"></script>
<input data-bind="value: startTime" type="Time" ></input>
<output id=startTime data-bind="text: startTime"></output>
<br />
<input data-bind="value: endTime" type="Time"></input>
<output id=endTime data-bind="text: endTime"></output>
<pre data-bind="text: ko.toJSON($data, null, 2)"></pre>
JavaScript
viewModel = {
//reset startTime and EndTime
startTime: ko.observable(moment().format('DD HH:mm:ss')),
endTime: ko.observable(moment().format('DD HH:mm:ss')),
timeDiff : ko.computed(function () {
console.log(this.startTime);
console.log(this.endTime);
return moment.duration(this.endTime - this.startTime).humanize();
})
};
ko.applyBindings(viewModel);