I am trying to figure out how I can get the duration between two dates either with or without momentjs.
here is the code I have implemented in the table using bootstrap-table
<tr>
<th id="startedat" data-field="StartedAt" data-formatter="dateFormatter">Started At</th>
<th id="finishedat" data-field="FinishedAt" data-formatter="dateFormatter">Finished At</th>
<th data-formatter="duration">Duration</th>
in my Javascript I would then use
function dateFormatter(value) {
return moment().format("dddd, MMMM Do YYYY, h:mm:ss a");
but how to do I now set up the function for duration? any ideas
with moment You can use .diff
var a = moment([2007, 0, 29]);
var b = moment([2007, 0, 28]);
a.diff(b) // 86400000