I wish to edit my 2013 Calendar web part and remove Saturday and Sunday from showing if possible so it only shows the work days of the week. Any help would be very much appreciated as i dont know where to start with it,
Cheers.
I wish to edit my 2013 Calendar web part and remove Saturday and Sunday from showing if possible so it only shows the work days of the week. Any help would be very much appreciated as i dont know where to start with it,
Cheers.
Maybe old, but I found a way which works for me.
Source: http://www.c-sharpcorner.com/UploadFile/fc34aa/hide-weekends-in-sharepoint-calendar-view/
Code:
<style type="text/css">
table.ms-acal-month > tbody > tr > th:nth-of-type(1) {
display: none !important;
}
table.ms-acal-month > tbody > tr > th:nth-of-type(7) {
display: none !important;
}
table.ms-acal-month > tbody > tr > th:nth-of-type(8) {
display: none !important;
}
table.ms-acal-month > tbody > tr > td:nth-of-type(6) {
display: none !important;
}
table.ms-acal-month > tbody > tr > td:nth-of-type(7) {
display: none !important;
}
</style>
I just followed the steps provided in the link which are mostly:
Use below script
<script type="text/javascript">
$(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";
}
}
}
}
}
});
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);
</script>