✨ We just launched Fimo.ai - an AI Website Builder to create websites in minutes - Try it now

Strapi plugin logo for Opening Hours Field

Opening Hours Field

This plugin adds an Opening Hours custom field to Strapi's Content-Type Builder. The field stores structured JSON following Schema.org OpeningHoursSpecification conventions, making it ready for SEO and structured data integration.

thumbnail for Opening Hours Field

Opening Hours Plugin

Strapi Plugin: Opening Hours

A custom field plugin for Strapi v5 that provides a rich UI for managing business opening hours, split shifts, and special/holiday schedules.

npm version npm downloads license release status GitHub stars

Strapi v5 Node.js >= 18 Schema.org compatible TypeScript


Overview

This plugin adds an Opening Hours custom field to Strapi's Content-Type Builder. The field stores structured JSON following Schema.org OpeningHoursSpecification conventions, making it ready for SEO and structured data integration.

Features

  • Weekly schedule — per-day open/closed toggle with time pickers
  • Split shifts — multiple time slots per day (e.g. lunch + dinner)
  • Copy hours — replicate one day's schedule to weekdays or all days
  • Special/holiday hours — named overrides with date ranges
  • Preview tab — read-only formatted summary of the full schedule
  • Schema.org compatible — JSON output follows OpeningHoursSpecification
  • Strapi Design System — built entirely with native Strapi components

Screenshots

Regular Hours

Set opening and closing times for each day of the week, with per-day open/closed toggles.

Regular Hours

Split Shifts

Add multiple time slots per day to handle lunch breaks, split shifts, or varying schedules.

Split Shifts

Copy Hours

Quickly replicate one day's schedule to all weekdays or all days at once.

Copy Hours

Special Hours

Define named overrides for holidays or special events, with date ranges and open/closed status.

Special Hours

Preview

A read-only summary of the full schedule, including both regular and special hours.

Preview

Quick Start

1. Install

yarn add @opkod-france/strapi-plugin-opening-hours

2. Enable the plugin

// config/plugins.ts
export default () => ({
  'opening-hours': {
    enabled: true,
  },
});

3. Rebuild and start

yarn build
yarn develop

4. Add the field

  1. Open the Content-Type Builder
  2. Add a new custom field and select Opening Hours
  3. Save the content type
  4. The field appears in the content editor with three tabs: Regular Hours, Special Hours, and Preview

JSON Structure

The field stores a single JSON object with two arrays:

{
  "regularHours": [
    {
      "dayOfWeek": "Monday",
      "isOpen": true,
      "timeSlots": [
        { "opens": "09:00", "closes": "12:00" },
        { "opens": "14:00", "closes": "18:00" }
      ]
    },
    {
      "dayOfWeek": "Sunday",
      "isOpen": false,
      "timeSlots": []
    }
  ],
  "specialHours": [
    {
      "label": "Christmas Day",
      "validFrom": "2025-12-25",
      "validThrough": "2025-12-25",
      "isOpen": false,
      "timeSlots": []
    }
  ]
}

Field Reference

FieldTypeDescription
dayOfWeekstringSchema.org day name (MondaySunday)
isOpenbooleanWhether the business is open
timeSlotsarrayTime ranges; empty when closed
opens / closesstringTime in HH:MM 24-hour format
labelstringName for a special hours entry
validFrom / validThroughstringISO date (YYYY-MM-DD)

Development

# Install dependencies
yarn install

# Build the plugin
yarn build

# Watch mode (rebuilds on changes)
yarn watch

# Run tests
yarn test

# Run tests in watch mode
yarn test:watch

Local Development

Link the plugin for local testing:

# In the plugin directory
yarn link

# In your Strapi project
yarn link @opkod-france/strapi-plugin-opening-hours

Then add an explicit resolve path in config/plugins.ts:

export default () => ({
  'opening-hours': {
    enabled: true,
    resolve: './node_modules/@opkod-france/strapi-plugin-opening-hours',
  },
});

Requirements

DependencyVersion
Strapi>= 5.0.0
Node.js>= 18
React17.x or 18.x

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

This project uses conventional commits and semantic-release for automated versioning.

License

MIT © Opkod France

Install now

npm install @opkod-france/strapi-plugin-opening-hours

STATS

No GitHub star yetNot downloaded this week

Last updated

3 days ago

Strapi Version

5.0.0 and above

Useful links

Create your own plugin

Check out the available plugin resources that will help you to develop your plugin or provider and get it listed on the marketplace.