JSFiddle - React, Tailwind, and code Playground

by Sunny SM

HTML

<script src="http://momentjs.com/downloads/moment.min.js"></script>

JavaScript

function compare(dateTimeA, dateTimeB) {
    var momentA = moment(dateTimeA,"DD/MM/YYYY");
    var momentB = moment(dateTimeB,"DD/MM/YYYY");
    if (momentA > momentB) return 1;
    else if (momentA < momentB) return -1;
    else return 0;
}

alert(compare("11/07/2015", "10/07/2015"));