JSFiddle - React, Tailwind, and code Playground

HTML

<script src="https://rawgithub.com/timrwood/moment/2.1.0/min/moment.min.js"></script>

JavaScript

var Countdown = function(endDate) {
    var endMoment = moment(endDate);

    this.updateCountdown = function() {
        var currentMoment, thisDiff;

        currentMoment = moment();
        thisDiff = (endMoment).diff(currentMoment, "seconds");

        if (thisDiff > 0)
            console.log(thisDiff);
        else {
            clearInterval(interval);
            console.log("over");
        }
    }
    
    var interval = setInterval(this.updateCountdown, 1000);
}

var countdown = new Countdown("January 1, 2014 00:00:00");