jonthornton / Datepair.js

A javascript plugin for intelligently selecting date and time ranges, inspired by Google Calendar.
https://www.jonthornton.com/Datepair.js
358 stars 87 forks source link

How to disable specific dates in datepicker using datepair #121

Closed ApekshaKatariya closed 4 years ago

ApekshaKatariya commented 4 years ago

i m just write this code to disable selected dates but not working

var array = ["17-03-2020", "25-03-2020", "28-03-2020"] / create an array of days which need to be disabled / $('#basicExample .date').datepicker({ format: 'd-mm-yyyy', autoclose: true, startDate: '-0m', endDate: '+1m',
beforeShowDay: function (date) { var string = jQuery.datepicker.formatDate('d-mm-yy', date); return [array.indexOf(string) == -1] } }); var basicExampleEl = document.getElementById('basicExample'); var datepair = new Datepair(basicExampleEl);

jonthornton commented 4 years ago

That's a setting specific to Datepicker- the Datepair library doesn't interact with disabled days in any way. Try the Datepicker documentation for more info https://github.com/uxsolutions/bootstrap-datepicker