Jump to content

Events Summary Block - Remove End Dates + End Times

Recommended Posts

I am using an Events Summary Block on my homepage. My events all start late and go into the next day. This means each event looks like it's multiple days. But it's not, it's just late. I tried changing the end time to 11:55pm, but then it looks like it ends early. Can I remove all end dates and end times from the Summary Block?

Link to comment

@WildGoose First off, you can hide the end date by setting the Secondary Metadata in your summary block settings to 'None'. See the screenshot for reference.

I just wrote this code solution to hide the end date. Add this code by navigating to Website > Pages > Website Tools > Code Injection > Header:

<script>
document.addEventListener("DOMContentLoaded", function() {
  const eventDate = document.querySelectorAll('time.summary-metadata-item.summary-metadata-item--date');

  eventDate.forEach(element => {
    const dateText = element.innerHTML;
    const endDateIndex = dateText.indexOf('–');
    if (endDateIndex !== -1) {
      element.innerHTML = dateText.substring(0, endDateIndex).trim();
    }
  });
});
</script>
  

 

Screenshot Capture - 2024-07-16 - 16-43-07.png

If my comments were useful, please like or mark my solution as answer so others can scroll to it quickly. 

Sam
Web Developer & Digital Designer

 Did you find my contribution helpful? Buy me a coffee?

Link to comment
  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.