JSFiddle - React, Tailwind, and code Playground

by JonNorman

HTML

start:<input type="text" id="st" value="01:00"><br>
end:<input type="text" id="et" value="12:00"><br>

JavaScript

$(document).ready(function() {
    $('#st').change(function(){
        var sd = Date.parse("01/01/01 "+$('#st').val());
        var ed = Date.parse("01/01/01 "+$('#et').val());
        if(isNaN(sd)){
            alert('end time not a time');
        }else if(isNaN(ed)){
            alert('end time not a time');
        }else if(sd>=ed){
            alert('end time always greater then start time');
        }
    });
});