jQuery UI Datepicker & DateTimePicker Addon

Download

https://jqueryui.com/download

https://github.com/trentrichardson/jQuery-Timepicker-Addon

https://www.dropbox.com/s/qhwuvv3asnr0vs8/jquery_datetimepicker.zip?dl=0

HTML

<link href="{{BASE_URL}}/plugins/jquery-ui/jquery-ui.min.css" rel="stylesheet" />
<link href="{{BASE_URL}}/plugins/DateTimePicker/jquery-ui-timepicker-addon.min.css" rel="stylesheet" />

<script src="{{BASE_URL}}/plugins/jquery-ui-1.10.4.custom.min.js"></script>
<script src="{{BASE_URL}}/plugins/jquery-ui-timepicker-addon.js"></script>

Javascript:

$('.datetimepicker').datetimepicker({
	"dateFormat": "yy-mm-dd",
	"timeFormat": "HH:mm"
});

$('.datepicker').datepicker({
	dateFormat: "yy-mm-dd"
});

Disable dates:

disabled_dates = ['2021-04-29'];
$('#pickup-date').datepicker({
	changeYear: true,
	dateFormat: "yy-mm-dd", 
	beforeShowDay: function(date){
	  var string = jQuery.datepicker.formatDate('yy-mm-dd', date);
	  var index = disabled_dates.indexOf(string);
	  console.log(index);
	  if(index == -1){
		return [true];
	  }else{
		return [false];
	  }
	}
});

Reference: