A DatoCMS json field editor plugin for managing business operating hours. Quickly define opening and closing times for specific weekdays with support for multiple time slots per day (e.g., morning and evening shifts).

Build the plugin:
npm installnpm run buildRegister in DatoCMS:
Create a JSON field:
Start using it:
The plugin stores data as a JSON array of schedule entries. Each entry contains selected weekdays and one or more time slot pairs.
interface ScheduleEntry { id: string; // Unique entry identifier weekdays: Weekday[]; // Array of selected days (0=Sunday, 6=Saturday) timeSlots: TimeSlot[]; // One or more open/close pairs}
interface Weekday { position: number; // 0-6 (0=Sunday, 6=Saturday) short: string; // "Sun", "Mon", "Tue", etc. long: string; // "Sunday", "Monday", "Tuesday", etc.}
interface TimeSlot { id: string; // Unique slot identifier open: string; // Opening time in HH:MM format close: string; // Closing time in HH:MM format}[ { "id": "entry-001", "weekdays": [ { "position": 1, "short": "Mon", "long": "Monday" }, { "position": 2, "short": "Tue", "long": "Tuesday" }, { "position": 3, "short": "Wed", "long": "Wednesday" }, { "position": 4, "short": "Thu", "long": "Thursday" }, { "position": 5, "short": "Fri", "long": "Friday" } ], "timeSlots": [ { "id": "slot-001", "open": "09:00", "close": "18:00" } ] }, { "id": "entry-002", "weekdays": [ { "position": 6, "short": "Sat", "long": "Saturday" } ], "timeSlots": [ { "id": "slot-002", "open": "10:00", "close": "16:00" } ] }][ { "id": "entry-lunch", "weekdays": [ { "position": 2, "short": "Tue", "long": "Tuesday" }, { "position": 3, "short": "Wed", "long": "Wednesday" }, { "position": 4, "short": "Thu", "long": "Thursday" } ], "timeSlots": [ { "id": "lunch-slot", "open": "11:30", "close": "14:00" }, { "id": "dinner-slot", "open": "18:00", "close": "22:30" } ] }]| Property | Value |
|---|---|
| Plugin ID | workingScheduleDays |
| Field Types | JSON (only) |
| Extension Type | Field editor |
| Configurable | No |
| Permissions | None required |
# Start development servernpm run dev
# Build for productionnpm run build
# Preview production buildnpm run previewsrc/├── main.tsx # Plugin initialization & SDK connection├── entrypoints/│ ├── WorkingSchedule.tsx # Main field editor component│ └── ConfigScreen.tsx # Configuration screen (minimal)├── lib/│ ├── constants.ts # WEEKDAYS constant│ ├── helper.ts # ID generation utilities│ ├── saveFieldValue.ts # Data persistence│ └── formValuesHelper.ts # Nested field value access├── components/│ ├── CloseIcon.tsx # Close button icon│ ├── PlusIcon.tsx # Add button icon│ └── MinusIcon.tsx # Remove button icon└── utils/ └── render.tsx # React DOM renderingThe plugin uses CSS Modules with custom properties for theming:
:root { --primary: #49abf5; /* Selected day background */ --accent-color: #6c5ce7; /* Button colors */ --remove-color: #ff6b6b; /* Remove button color */ --schedule-white: #f5f5f5; /* Light backgrounds */}Edit src/entrypoints/WorkingSchedule.module.css to customize colors and layout.
To add additional fields to the schedule (e.g., staff notes, location):
ScheduleEntry interface in src/entrypoints/WorkingSchedule.tsxScheduleEntryComponentsaveFieldValue() callFound a bug or have a feature request?
This plugin is inspired by and built upon the work of the Elevation Church - DatoCMS Plugin Schedule Listings project.
Reference Plugin: datocms-plugin-schedule-listings
MIT License - feel free to use this plugin in your DatoCMS projects