I've seen a few different questions on here regarding finding the difference between using two different dates.
My question is similar to Parse ONLY a time string with DateJS.
I basically have 2 time inputs:
<input id="start_time" type="text">
<input id="end_time" type="text">
The format of these will always be: 07:15 AM
or 08:30 AM
Essentially, what I am trying to do is ensure the start_time
is not greater than the end_time
.
I have tried using DateJS to parse the date, but it returns null
:
Date.parseExact("03:15 PM", "HH:mm"); <--- returns null
How should I go about comparing the two input fields (using DateJS or something else) to ensure the start_time is not greater than the end_time?
Any help would be great.