title: Datetimepicker not changing date time onSelect
body: <p><strong>The problem:</strong></p>
  
  <p>I have two datetimepicker elements utilizing <a href="http://trentrichardson.com/examples/timepicker/" rel="nofollow">trent richardson's datetimepicker</a></p>
  
  <p>The first element selects a start date/time and the second selects an end date/time.
  When a date/time is changed i want to check that the start event is still before the end event. If not: the datetimepicker should revert to it's previous value. </p>
  
  <p><strong>What i've tried</strong></p>
  
  <pre><code>$("selector").datetimepicker(function(){
      //other init values.
      onSelect: function(){
           var start = $("#startStamp").val();
           var stop = $("#stopStamp").val();
           if(calculateTimeDiff(start, stop) &lt;= 0){
               alert("Start time may not exceed end time");
               $(this).datetimepicker("setDate",obj.lastVal);
           }
  
      }
  }
  </code></pre>
  
  <p>calculateTimeDiff() is a function that returns number of milliseconds between start and end date. </p>
  
  <p><strong>What happens</strong></p>
  
  <p>If the date selected for start value is after the end value. Then everything acts like supposed. The value is reverted. </p>
  
  <p>But if both start and end value is on the same date and the time is changed so that it exceeds the end value. Then the date value is set to current date and time value isn't reset at all. If the dialog is closed after that, no value is return to the input field. </p>
  
  <p>I've tried console.log(obj) both when you change a date and when you just change the time. 
  and found out that obj.lasVal isn't set when just the time is changed. (A bit odd, i think).</p>
  
  <p><strong><a href="http://jsfiddle.net/xqo2653k/" rel="nofollow">JSFiddle</a></strong></p>
  
  <p><strong>Question</strong></p>
  
  <p>What am i doing wrong or could this be done in some other way?</p>