Limit Week Time Grid View to Specific Hours

When you're utilizing the "Week - Time Grid" calendar view, you might want to limit the visible range of hours to something like 8:00am to 8:00pm, instead of the default 24 hour display of 12:00am to 12:00pm.

Utilizing the sample code snippet at the bottom of this article, you can customize what times range appears. Note this applies only to the "Week - Time Grid" view.

The time format is in 24 hours time and requires seconds like: 19:00:00

If you're using a page builder like Gutenberg or Oxygen Builder, paste the script below into a Code Block on the page where Pie Calendar is present.

If you prefer to use a custom code snippet plugin, load this script in the footer of your website to ensure compatibility.

<script>

var ready = (callback) => {

if (document.readyState != "loading") callback();

else document.addEventListener("DOMContentLoaded", callback);

}


ready(() => {

window.calendar.setOption('slotMinTime', '08:00:00');

window.calendar.setOption('slotMaxTime', '20:00:00');

});

</script>

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.