1

Im my application in Sharepoint Online I need remove or disable tuesday and monday from datepicker, it is possible?

enter image description here

1

Insert a CEWP on your Calendar Page and refer it to the below script:

$(document).ready(function(){

var oTable = document.getElementsByTagName("table");
if (oTable != null) {

for (i = 0; i < oTable.length; i++)
{
 var table = oTable.item(i);
 if (table.className == "ms-acal-month")
 {
  for (var c = 0; c < table.rows.length; c++)
  {
  if (table.rows[c].cells.length == 8)
  {
   table.rows[c].cells[0].style.display = "none";
   table.rows[c].cells[1].style.display = "none";
   table.rows[c].cells[7].style.display = "none";
  }
  else if (table.rows[c].cells.length == 7)
  {
   table.rows[c].cells[0].style.display = "none";
   table.rows[c].cells[6].style.display = "none";
  }
  else if (table.rows[c].cells.length == 6)
  {
   table.rows[c].cells[0].style.display = "none";
   table.rows[c].cells[5].style.display = "none";
  }
  else if (table.rows[c].cells.length == 2)
  {
   table.rows[c].cells[0].style.display = "none";
   table.rows[c].cells[1].style.display = "none";
    }
   }
  }
 }
} 
 });

//For month view
function month(){

var oTable = document.getElementsByTagName("table");
if (oTable != null) {

for (i = 0; i < oTable.length; i++)
{
var table = oTable.item(i);
if (table.className == "ms-acal-month")
{
for (var c = 0; c < table.rows.length; c++)
{
if (table.rows[c].cells.length == 8)
{
 table.rows[c].cells[0].style.display = "none";
 table.rows[c].cells[1].style.display = "none";
 table.rows[c].cells[7].style.display = "none";
 }
 else if (table.rows[c].cells.length == 7)
 {
  table.rows[c].cells[0].style.display = "none";
  table.rows[c].cells[6].style.display = "none";
  }
  else if (table.rows[c].cells.length == 6)
  {
  table.rows[c].cells[0].style.display = "none";
  table.rows[c].cells[5].style.display = "none";
  }
  else if (table.rows[c].cells.length == 2)
  {
   table.rows[c].cells[0].style.display = "none";
   table.rows[c].cells[1].style.display = "none";
   }

   }
  }
 }
}
 }
       // For Week View
       function week(){

      var oTable = document.getElementsByTagName("table");
      if (oTable != null) {

      for (i = 0; i < oTable.length; i++)
      {
      var table = oTable.item(i);
      if (table.className == "ms-acal-detail")
      {
      for (var c = 0; c < table.rows.length; c++)
      {
      if (table.rows[c].cells.length == 8)
      {
      table.rows[c].cells[0].style.display = "none";
      table.rows[c].cells[1].style.display = "none";
      table.rows[c].cells[7].style.display = "none";
      }
      else if (table.rows[c].cells.length == 7)
      {
      table.rows[c].cells[0].style.display = "none";
      table.rows[c].cells[6].style.display = "none";
      }
      else if (table.rows[c].cells.length == 6)
      {
      table.rows[c].cells[0].style.display = "none";
      table.rows[c].cells[5].style.display = "none";
      }
      else if (table.rows[c].cells.length == 2)
      {
      table.rows[c].cells[0].style.display = "none";
      table.rows[c].cells[1].style.display = "none";
      }

           }
          }
         }
        }
       }



      $( "#WPQ2_nav_prev_a" ).click(function() {
       month();
      })
      $( ".ms-picker-table" ).click(function() {
      month();
      })
      $( "#WPQ2_nav_next_a" ).click(function() {
      month();
      })
      setInterval(function () { month()}, -10000);
      setInterval(function () { month()}, -10000);
      setInterval(function () { week()}, -10000);
| improve this answer | |
  • Hi Ravi, this solutions is to hide the week days in calendar, I need restrict days in datepicker. – Eduardo Freitas Aug 6 '19 at 22:27
  • Hi Ravi, this solutions is to hide the week days in calendar, I need restrict days in datepicker. – Eduardo Freitas Aug 6 '19 at 22:27
0

The SharePoint Date Picker control does not support this.

You should use the jQuery Date Picker control.

Information about how to disable specific days in JQuery datepicker:

https://www.codeproject.com/Questions/876970/how-to-disable-specific-days-in-JQuery-datepicker

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.