zabuto / calendar

This library is a jQuery plugin that lets you add a month calendar to your web page.
MIT License
351 stars 160 forks source link

Ability to disable days of the week and specific dates. #72

Closed simondotwhite closed 5 years ago

simondotwhite commented 6 years ago

This update allows you to disable days of the week and specific dates from being selected.

It will also ignore any events for disabled days.

zabuto commented 5 years ago

See v2. Thank you for your input!

var disable = ['2019-01-02', '2019-01-15', '2019-01-30'];
$el.zabuto_calendar();
$el.on('calendar:day', function (e) {
  if (disable.indexOf(e.value) === -1) {
    return;
  }
  if (e.date.getDay() === 0 || e.date.getDay() === 6) {
    return;
  }

  /* do stuff */
});
Kishorchhugani commented 3 years ago

I tried in this way but its not working. i want to disable the weekends in the calander.