How to validate the date time in datepicker?
问题 I have two datetimepickers in a form to enter the start time and end time. The ID of the start time is "startTime" and that of end time is "endTime". var startTime = document.getElementById("startTime"); var endTime = document.getElementById("endTime"); if (new Date(startTime.value).getTime() > new Date(endTime.value).getTime()) { alert("End Time should be greater than Start Time"); return false; } I tried to compare the start time and end time and validated that the start time should not be