Hide or remove Saturday and Sunday from List Calendar View

Home Forums Modern CEWP Hide or remove Saturday and Sunday from List Calendar View

Viewing 0 reply threads
  • Author
    Posts
    • #38604
      Wayne Thompson
      Participant

        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

    Viewing 0 reply threads
    • You must be logged in to reply to this topic.