How to disable Sunday and Monday in the calendar

In order to disable all Sunday and Monday dates from the calendar you will need to use a custom script that overwrites the default date selection event. A similar article on this topic can be found here.

The script will need to be placed in the CSS and Javascript tab. This will be triggered each time the user will make a selection in the calendar field.

<script type="text/javascript">
  function rsfp_onSelectDate(date, type, args, calendar)
{
var dates = args[0];
var date = dates[0];
var year = date[0], month = date[1], day = date[2];
 
var d = new Date(year, month-1, day);
if (d.getDay() == 0 || d.getDay() == 1) {
alert('Please select a date that is different from Monday or Sunday!');
return false;
} else {
return true;
}
}
</script>

15 persons found this article helpful.


Was this article helpful?

Yes No
Sorry about that

You Should Also Read

Custom PHP code HOT

Display PHP variables by default when form is shown HOT

Custom validation rules HOT

PHP Scripts HOT

Controlling the calendar HOT