Skip to content

Instantly share code, notes, and snippets.

@mathollingsworth
Last active August 29, 2015 14:20
Show Gist options
  • Save mathollingsworth/184a1e9d170705867fde to your computer and use it in GitHub Desktop.
Save mathollingsworth/184a1e9d170705867fde to your computer and use it in GitHub Desktop.
Craft Store Hours Open / Closed
{% set arrayPosition = now|date('w') %}
{% set today = openingHours.storeHours[arrayPosition] %}
{% set tomorrow = openingHours.storeHours[arrayPosition > 6 ? 0 : arrayPosition + 1] %}
<p class="u-mb0 text--center">
{% if today.open.getTimestamp() < now.getTimestamp() and today.close.getTimestamp() > now.getTimestamp() %}
<a href="{{ siteUrl }}menu" class="c--brand-secondary">Open today til late</a>
{% else %}
<a href="{{ siteUrl }}menu" class="c--brand-secondary">Open tomorrow at {{ tomorrow.open.localeTime }}</a>
{% endif %}
</p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment