Hide or remove Saturday and Sunday from List Calendar View
- This topic has 0 replies, 1 voice, and was last updated 1 year, 6 months ago by .
Viewing 0 reply threads
Viewing 0 reply threads
- You must be logged in to reply to this topic.
Home › Forums › Modern CEWP › Hide or remove Saturday and Sunday from List Calendar View
Hi everyone! 🙂
Seeking volunteers and examples of any custom code for the following scenario:
How to hide or remove Saturday and Sunday from the Month layout of a List Calendar View in a modern SP site using the Modern CEWP.
This is what I was working with, but I am not having any success:
document.addEventListener(‘DOMContentLoaded’, function() {
// Function to hide Saturday and Sunday columns in the month view
function hideWeekends() {
// Select all calendar cells
var calendarCells = document.querySelectorAll(‘.ms-Grid-col’);
calendarCells.forEach(function(cell) {
// Check if the cell represents Saturday or Sunday
var day = cell.getAttribute(‘data-day’);
if (day === ‘Saturday’ || day === ‘Sunday’) {
cell.style.display = ‘none’;
}
});
}
// Run the function to hide weekends
hideWeekends();
});
Thanks,
Wayne