Last active
          August 29, 2015 14:27 
        
      - 
      
- 
        Save bertrandmartel/8dd4371db30121204969 to your computer and use it in GitHub Desktop. 
    [ DateTimePicker Issue ] Range between dates with plus one day value
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Range between dates with plus one day value</title> | |
| <script src="http://momentjs.com/downloads/moment.min.js"></script> | |
| <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> | |
| <link rel="stylesheet" type="text/css" href="./jquery.datetimepicker.min.css"/> | |
| <script> | |
| Date.parseDate = function( input, format ){ | |
| return moment(input,format).toDate(); | |
| }; | |
| Date.prototype.dateFormat = function( format ){ | |
| return moment(this).format(format); | |
| }; | |
| </script> | |
| </head> | |
| <body> | |
| <input style='font-size:large;' id="date_timepicker_start" /> To <input style='font-size:large;' id="date_timepicker_end"/> | |
| <script type="text/javascript" language="javascript" src="http://code.jquery.com/jquery-1.11.1.min.js"></script> | |
| <script type="text/javascript" language="javascript" src="./jquery.datetimepicker.min.js"></script> | |
| <script> | |
| $(function() { | |
| function checkDateStart() | |
| { | |
| if (jQuery('#date_timepicker_start').val()){ | |
| var date = new Date(jQuery('#date_timepicker_start').val()); | |
| date.setDate(date.getDate()+1); | |
| return date.dateFormat('Y/m/d'); | |
| } | |
| return false; | |
| } | |
| jQuery(function(){ | |
| jQuery('#date_timepicker_start').datetimepicker({ | |
| format:'Y/m/d', | |
| onShow:function( ct ){ | |
| this.setOptions({ | |
| maxDate:jQuery('#date_timepicker_end').val()?jQuery('#date_timepicker_end').val():false | |
| }) | |
| }, | |
| timepicker:false | |
| }); | |
| jQuery('#date_timepicker_end').datetimepicker({ | |
| format:'Y/m/d', | |
| onShow:function( ct ){ | |
| this.setOptions({ | |
| minDate:checkDateStart() | |
| }) | |
| }, | |
| timepicker:false | |
| }); | |
| }); | |
| }); | |
| </script> | |
| </body> | |
| </html> | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment