0

I want to disable Next date on datepicker. In this code I am able to hide weekend dates easily but I did not find any solution for hide Next date always.

As an Example today is Date 21-04-2017 so on Datepicker Date 22-04-2017 should be hide but other dates should be active.

var newWeekends = (weekends) ? $.datepicker.noWeekends : false;
var newDaysNb = (date_nb_days == 0) ? '1' : date_nb_days;
$( function() {
$( "#datepicker" ).datepicker({
timeFormat: "hh:mm tt",
beforeShowDay:$.datepicker.noWeekends,                    
changeYear: false,  
});
});
Gourav bagora
  • 73
  • 1
  • 1
  • 12

1 Answers1

1

Update 2:
Below is the code for hiding next date:

var tomorrow = new Date();
tomorrow.setDate(tomorrow.getDate() + 1);
var dd = tomorrow.getDate();
var mm = tomorrow.getMonth()+1; //January is 0!

var yyyy = tomorrow.getFullYear();
if(dd<10){
    dd='0'+dd;
} 
if(mm<10){
    mm='0'+mm;
} 
var today = yyyy+'-'+mm+'-'+dd;
var array = []
array.push(today);

console.log(array)
$('input').datepicker({
    language:'TR',
    beforeShowDay: function(date){
        var string = jQuery.datepicker.formatDate('yy-mm-dd', date);
        return [ array.indexOf(string) == -1 ]
    }
});
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script>
<link href="https://davidwalsh.name/demo/jquery-ui-css/custom-theme/jquery-ui-1.7.2.custom.css" rel="stylesheet"/>

<input type='text' id='visit' />
Kung Fu Panda
  • 636
  • 10
  • 22