PHPackages                             craftcms/store-hours - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. craftcms/store-hours

ActiveCraft-plugin[Parsing &amp; Serialization](/categories/parsing)

craftcms/store-hours
====================

This plugin adds a new “Store Hours” field type to Craft, for collecting the opening and closing hours of a business for each day of the week.

4.2.0(1y ago)60104.4k↓69.6%15[7 issues](https://github.com/craftcms/store-hours/issues)[3 PRs](https://github.com/craftcms/store-hours/pulls)1MITPHPPHP ^8.2CI passing

Since May 10Pushed 1mo ago5 watchersCompare

[ Source](https://github.com/craftcms/store-hours)[ Packagist](https://packagist.org/packages/craftcms/store-hours)[ RSS](/packages/craftcms-store-hours/feed)WikiDiscussions 4.x Synced 2d ago

READMEChangelog (5)Dependencies (4)Versions (25)Used By (1)

Store Hours for Craft CMS
=========================

[](#store-hours-for-craft-cms)

This plugin adds a new “Store Hours” field type to Craft, for collecting the opening and closing hours (or any other time slots) of an organization for each day of the week.

Requirements
------------

[](#requirements)

This plugin requires Craft CMS 5.0 or later.

Installation
------------

[](#installation)

You can install this plugin from the Plugin Store or with Composer.

#### From the Plugin Store

[](#from-the-plugin-store)

Go to the Plugin Store in your project’s Control Panel and search for “Store Hours”. Then press **Install** in its modal window.

#### With Composer

[](#with-composer)

Open your terminal and run the following commands:

```
# go to the project directory
cd /path/to/my-project.test

# tell Composer to load the plugin
composer require craftcms/store-hours

# tell Craft to install the plugin
php craft plugin/install store-hours
```

Customizing Time Slots
----------------------

[](#customizing-time-slots)

Store Hours fields have a setting called “Time Slots” that lets you customize the time columns that will be visible in the field inputs. By default there will be two time slots, “Opening Time” and “Closing Time”, but you can customize those however you like.

[![A Time Slots field setting with “Open”, “Close”, “Second Open”, and “Second Close” slots defined](assets/time-slots.png)](assets/time-slots.png)

Each row you add here will end up adding a new column to the field inputs.

[![A Store Hours field with four custom time slots](assets/field.png)](assets/field.png)

Templating
----------

[](#templating)

You can loop through your Store Hours fields to access info for each day of the week (starting with Sunday):

```
Opening Hours

  {% for day in entry. %}
    {{ day.name }}

      {% if day.isBlank %}
        Closed
      {% else %}
        {{ day.open|time }} - {{ day.close|time }}
      {% endif %}

  {% endfor %}

```

The exact time format that will be used when outputting times with the `|time` filter depends on the current application locale. See the [Craft documentation](https://docs.craftcms.com/v3/dev/filters.html#time) for details on how it can be customized.

### Showing a Single Day’s Hours

[](#showing-a-single-days-hours)

You can get the hours for a single day using the following methods:

MethodDay`getSun()`Sunday`getMon()`Monday`getTue()`Tuesday`getWed()`Wednesday`getThu()`Thursday`getFri()`Friday`getSat()`Saturday`getYesterday()`Yesterday`getToday()`Today`getTomorrow()`Tomorrow```
Today’s Hours
{% set today = entry..today %}
{% if today.isBlank %}
  Sorry, we’re closed today.
  {% set tomorrow = entry..tomorrow %}
  {% if not tomorrow.isBlank %}
    We’ll be back open tomorrow at {{ tomorrow.open|time }}.
  {% endif %}
{% else %}
  We’re open from {{ today.open|time }} to {{ today.close|time }} today.
{% endif %}
```

### Showing a Custom Day Range

[](#showing-a-custom-day-range)

To only show certain days of the week (e.g only Monday through Friday), use the `getRange()` field method. Pass two integers in to represent the start and end days of the range, using this mapping:

NumberDay`0`Sunday`1`Monday`2`Tuesday`3`Wednesday`4`Thursday`5`Friday`6`Saturday```
{# Only show Monday-Friday #}
{% set range = entry..getRange(1, 5) %}

{% for day in range %}
    {# ... #}
{% endfor %}
```

### Showing Grouped Ranges

[](#showing-grouped-ranges)

You can show consolidated list of hours, such as:

> **11am** – **6pm** Mon – Fri
> **11am** – **5pm** Sat – Sun

To do that, use the `getGroupedRanges()` field method, which is similar to `getRange()`, except the resulting days are grouped by their time slots.

```

  {% for group in entry..getGroupedRanges(1) %}
    {% set first = group|first %}
    {% set last = group|last %}
    {% if first.open and first.close %}

          {{ first.open|date('g:sa')|replace(':00', '') }}&hairsp;–&hairsp;{{ first.close|date('g:sa')|replace(':00', '') }}

        {% if first != last %}
          {{ first.getName('medium') }}&hairsp;–&hairsp;{{ last.getName('medium') }}
        {% else %}
          {{ first.getName('medium') }}
        {% endif %}
      {% endif %}

  {% endfor %}

```

### Changing the Week Start Day

[](#changing-the-week-start-day)

You can use the `getRange()` field method to return the full list of days with a different week start day. For example, if you want Monday to be the first day of the week, do this:

```
{# Show all days with Monday first #}
{% set range = entry..getRange(1, 0) %}

{% for day in range %}
  {# ... #}
{% endfor %}
```

As a shortcut, you can also skip passing the end day when you want to do this:

```
{# Show all days with Monday first #}
{% set range = entry..getRange(1) %}

{% for day in range %}
  {# ... #}
{% endfor %}
```

### Determining Whether All Slots are Blank

[](#determining-whether-all-slots-are-blank)

You can quickly find out whether all the time slots in a day were left blank using the `getIsBlank()` (`isBlank`) field method:

```
Opening Hours

  {% for day in entry. %}
    {{ day.name }}

      {% if day.isBlank %}
        Closed
      {% else %}
        {{ day.open|time }} - {{ day.close|time }}
      {% endif %}

  {% endfor %}

```

###  Health Score

57

—

FairBetter than 98% of packages

Maintenance61

Regular maintenance activity

Popularity44

Moderate usage in the ecosystem

Community23

Small or concentrated contributor base

Maturity85

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 71.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~120 days

Recently: every ~34 days

Total

23

Last Release

705d ago

Major Versions

2.1.1.1 → 3.0.0-beta.12022-03-18

2.2.0 → 3.0.0-beta.22022-04-11

v2.x-dev → 3.0.02022-05-03

3.x-dev → 4.0.02024-03-15

PHP version history (2 changes)3.0.0-beta.1PHP ^8.0.2

4.0.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/3ccdf8b493035de2343c55bd889513e3af5c04d5823482a2b186ad16adb1c3e3?d=identicon)[brandonkelly](/maintainers/brandonkelly)

---

Top Contributors

[![brandonkelly](https://avatars.githubusercontent.com/u/47792?v=4)](https://github.com/brandonkelly "brandonkelly (117 commits)")[![angrybrad](https://avatars.githubusercontent.com/u/61869?v=4)](https://github.com/angrybrad "angrybrad (32 commits)")[![MakeilaLundy](https://avatars.githubusercontent.com/u/19892516?v=4)](https://github.com/MakeilaLundy "MakeilaLundy (8 commits)")[![benjamindavid](https://avatars.githubusercontent.com/u/2911900?v=4)](https://github.com/benjamindavid "benjamindavid (2 commits)")[![mrwijsman](https://avatars.githubusercontent.com/u/82064787?v=4)](https://github.com/mrwijsman "mrwijsman (1 commits)")[![carlcs](https://avatars.githubusercontent.com/u/7516543?v=4)](https://github.com/carlcs "carlcs (1 commits)")[![drifteaur](https://avatars.githubusercontent.com/u/3732?v=4)](https://github.com/drifteaur "drifteaur (1 commits)")[![lassemt](https://avatars.githubusercontent.com/u/2833312?v=4)](https://github.com/lassemt "lassemt (1 commits)")

---

Tags

craft-plugincraft2craft3craftcmsjsonhtmlcmsyii2storecraftcmshours

### Embed Badge

![Health badge](/badges/craftcms-store-hours/health.svg)

```
[![Health](https://phpackages.com/badges/craftcms-store-hours/health.svg)](https://phpackages.com/packages/craftcms-store-hours)
```

###  Alternatives

[craftcms/commerce

Craft Commerce

240425.9k185](/packages/craftcms-commerce)[craftcms/element-api

Create a JSON API for your elements in Craft

502710.4k10](/packages/craftcms-element-api)[craftcms/ckeditor

Edit rich text content in Craft CMS using CKEditor.

47406.3k76](/packages/craftcms-ckeditor)[verbb/formie

The most user-friendly forms plugin for Craft.

102393.6k69](/packages/verbb-formie)[verbb/vizy

A flexible visual editor field for Craft.

4250.4k](/packages/verbb-vizy)[verbb/hyper

A user-friendly links field for Craft.

24147.8k12](/packages/verbb-hyper)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
