Show “All Day” on Events (7.1)

Squarespace doesn’t have an “All Day” option for events. Every event needs a start and end time, so if you have something like a holiday closure or an all-day festival, it ends up showing a time like 9:00 AM – 5:00 PM, which isn’t quite right.

As a workaround, you can use the code below. It looks for any event that’s set to a “trigger” time of 9:01 AM to 5:01 PM and swaps the time out for “All Day”. I picked those times because you’d almost never use them for a real event, so your other events won’t be affected.

It changes the time on the event page and the events list, and it also works on Summary Blocks that show your events. Events that run over multiple days work too.

First, open your event and set the start time to 9:01 AM and the end time to 5:01 PM.

Then put the code below into Pages → Custom Code → Code Injection, in the Footer box.

<!-- Show "All Day" on events -->
<style>
  .cds-all-day .event-time-localized,
  .cds-all-day .event-time-localized-start,
  .cds-all-day .event-time-localized-end,
  .cds-all-day .eventlist-meta-time,
  .cds-all-day .eventitem-meta-time,
  .cds-all-day .event-time-12hr,
  .cds-all-day .event-time-24hr {
    display: none !important;
  }
  .cds-all-day .event-date::after {
    content: none !important;
  }
  .cds-all-day .event-date ~ .cds-all-day-label::before {
    content: " \00B7  ";
  }
</style>
<script>
(function () {
  // Set your event to these times to make it "All Day"
  var START_TIME = '9:01 AM';
  var END_TIME = '5:01 PM';
  var LABEL = 'All Day';

  function toMinutes(text) {
    var m = String(text)
      .match(/(\d{1,2})[:.](\d{2})\s*([ap])?/i);
    if (!m) return null;
    var h = parseInt(m[1], 10);
    var min = parseInt(m[2], 10);
    if (m[3]) {
      h = h % 12;
      if (m[3].toLowerCase() === 'p') h += 12;
    }
    return h * 60 + min;
  }
  var start = toMinutes(START_TIME);
  var end = toMinutes(END_TIME);

  var ROWS = '.eventlist-meta-time, .eventitem-meta-time, ' +
    '.eventlist-meta-date, .eventitem-meta-date, ' +
    '.summary-metadata-item';
  var TIMES = '.event-time-localized-start, ' +
    '.event-time-localized-end, ' +
    'time.event-time-localized, .event-time-12hr';

  function check(row) {
    if (row.querySelector('.cds-all-day-label')) return;
    var times = row.querySelectorAll(TIMES);
    var plain = !times.length &&
      row.matches('.summary-metadata-item--event-time');
    if (!times.length && !plain) return;

    var found = [];
    (plain ? [row] : times).forEach(function (t) {
      t.textContent.split(/[–—-]/)
        .forEach(function (part) {
          var v = toMinutes(part);
          if (v !== null) found.push(v);
        });
    });
    if (found.length < 2) return;
    if (found[0] !== start) return;
    if (found[found.length - 1] !== end) return;

    var label = document.createElement('span');
    label.className = 'cds-all-day-label';
    label.textContent = LABEL;
    if (plain) row.textContent = '';
    row.classList.add('cds-all-day');
    row.appendChild(label);
  }

  function run() {
    document.querySelectorAll(ROWS).forEach(function (row) {
      var parent = row.parentElement;
      if (parent && parent.closest('.cds-all-day')) return;
      check(row);
    });
  }

  if (document.readyState === 'loading') {
    document.addEventListener('DOMContentLoaded', run);
  } else {
    run();
  }
  window.addEventListener('load', run);

  var timer;
  new MutationObserver(function () {
    clearTimeout(timer);
    timer = setTimeout(run, 100);
  }).observe(document.documentElement, {
    childList: true,
    subtree: true
  });
})();
</script>

Customize

To use a different trigger time, change ‘9:01 AM’ and ‘5:01 PM’ near the top of the code. Just make sure they match the times you set on your event.

To change the wording, replace ‘All Day’ with whatever you’d like it to say, like ‘Open All Day’.

Note: the Google Calendar and ICS buttons will still show 9:01 AM to 5:01 PM, since Squarespace creates those itself.

Need more advanced customization for your events? Book a consultation with me to discuss the details!

Clementine Design Studio

I’m a Squarespace expert with a BA in Communication Design (with an emphasis in web design), and I’ve designed hundreds of websites over the past 7+ years. I love working with small businesses and entrepreneurs to create beautiful, functional websites that stand out from the competition and attract the right clients.

https://clementinedesign.studio
Next
Next

Create a Full-Width Scrolling Logo Banner