JSFiddle - React, Tailwind, and code Playground

by hamix

HTML

<input type="text" id="today" />
<input type="text" id="tomorrow" />
<input type="button" id="checkDate" />

JavaScript

$(document).ready(function () {
    var today = new Date();
    var tomorrow = new Date(today);
    tomorrow.setDate(today.getDate() + 1);
    $("#today").val(today.toUTCString());
    $("#tomorrow").val(tomorrow.toUTCString());
    $("#checkDate").click(function () {
        var newDate = new Date($("#today").val());
        newDate.setDate(newDate.getDate() + 2);
        var parsedTomorrow = new Date($("#tomorrow").val());
        var comRes = newDate > parsedTomorrow;
        alert(comRes);
    });
});