JSFiddle - React, Tailwind, and code Playground

by Derek Leung

HTML

Difference:

JavaScript

Number.prototype.format = function(){
    return [
        (this/86400|0), "days",
        (this/3600|0) % 24 , "hours",
        (this/60|0) % 60 , "minutes",
        (this|0) % 60 , "seconds"
    ].join(" ");
};

var date1 = new Date("2014-12-25 12:23:56"),
    date2 = new Date("2013-12-25 11:20:21");

$("body").append(((date1 - date2)/1000|0).format());