title: Comparing start time and end time
body: <p>I know there are many questions asked about this topic here but no one is about the problem I have.<br /></p>
  
  <p>This script is for reservations where the user selects the date and the start and end time and makes a reservation.
  I have a form with a date selector input field and two time selector input fields, one for the start time and one for the end time.</p>
  
  <p>The problem is that the store which I'm writing the reservation script for is opened from 17:00 evening to 01:00 morning. So if someone is reserving from 23:00 to 01:00 the start time is always shown as bigger, which results in that the form is not validated.</p>
  
  <p>Does anyone know if there is a solution to this or if there is a validator out there which can do this. </p>
  
  <p><em>NOTE: I only want to compare the times and I don't want to add another date field.</em> </p>
  
  <p><a href="https://i.stack.imgur.com/ae0I1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ae0I1.png" alt="enter image description here"></a></p>
  
  <pre><code>var timeto=$('#timeto').val();
  var timefrom=$('#timefrom').val();
          if(timefrom&gt;timeto){
              alert('start time should be smaller')
          }
  </code></pre>
  
  <p>So if <code>time from</code> is 23:00 and <code>time to</code> is 00:00 than the alert is shown,but in reality 00:00 is a greater time than 23:00</p>