npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

directus-extension-schedule

v1.1.0

Published

Schedule interface with start and end date fields, automatic draft creation, and cron-like monitoring

Downloads

18

Readme

Directus Schedule Extension

A comprehensive schedule interface for Directus with start and end date fields, time selection, and automatic draft creation for schedule mismatches.

Preview

Schedule Interface Preview

Features

  • Date Range Selection: Choose start and end dates with an intuitive calendar interface
  • Time Selection: Optional time picker for precise scheduling
  • Multiple Display Formats: Support for various date display formats (short, medium, long, numeric, European, ISO)
  • Validation Rules: Configurable validation for date relationships and future dates
  • Draft Mode: Automatic creation of draft entries when schedules don't match current time
  • Cron-like Monitoring: Periodic checks for schedule mismatches (configurable interval)
  • Automatic Status Management: Hooks system that automatically changes collection items to draft when schedules end
  • Real-time Monitoring: Continuous monitoring of schedule end times with automatic status updates

Installation

  1. Build the extension:

    npm run build
  2. Link it to your Directus instance:

    npm run link

Configuration Options

Basic Options

  • Start Date Field: Field name for the start date (default: start_date)
  • End Date Field: Field name for the end date (default: end_date)
  • Show Time: Enable time selection in addition to date selection
  • Required: Make both start and end dates required fields
  • Display Format: Choose how dates are displayed in the input field
  • Validation: Set validation rules for date relationships

Draft Mode Options

  • Collection for Drafts: Select from available collections where draft entries will be created
  • Enable Draft Mode: Toggle automatic draft creation for schedule mismatches
  • Cron Check Interval: Set the interval (in milliseconds) for checking schedule mismatches
  • Auto Draft on End: Automatically change item status to draft when schedule ends

Draft Mode Functionality

When enabled, the schedule interface automatically monitors for cases where the current Directus time doesn't match the selected schedule range:

Mismatch Detection

  • Before Start: Shows warning when current time is before scheduled start time
  • After End: Shows error when current time is past scheduled end time
  • Within Range: No mismatch detected when current time is within the schedule

Automatic Draft Creation

When a mismatch is detected, users can manually trigger the creation of a draft entry that includes:

  • Original schedule information
  • Current mismatch status
  • Timestamp of creation
  • Descriptive notes about the mismatch

Cron-like Monitoring

The interface runs periodic checks (default: every 5 minutes) to detect schedule mismatches automatically. This ensures that:

  • Mismatches are detected even when the interface is not actively being used
  • Users are notified of schedule issues in real-time
  • Draft entries can be created proactively

Hooks System

The extension includes a powerful hooks system that automatically manages collection item statuses when schedules end:

Automatic Status Management

  • Real-time Monitoring: Continuously monitors schedule end times
  • Automatic Draft Conversion: Changes item status to draft when schedule ends
  • Batch Processing: Handles multiple ended schedules efficiently
  • Configurable: Customizable collection names, field names, and status values

Hook Events

  • items.create: Triggers when new schedules are created
  • items.update: Triggers when existing schedules are modified
  • cron: Periodic checks for ended schedules (configurable interval)

Status Tracking

  • Audit Trail: Records when and why items were auto-drafted
  • Metadata: Adds auto_drafted_at and auto_draft_reason fields
  • Event Emission: Optional custom event emission for external integrations

For detailed information about the hooks system, see HOOKS.md.

Automatic Draft Status Changes

When enabled, the interface automatically changes the current item's status to "draft" when a schedule ends:

  • Immediate Detection: Checks for ended schedules when the component mounts
  • Automatic Updates: Changes status to draft without user intervention
  • Status Tracking: Records when the schedule ended and adds explanatory notes
  • Manual Override: Users can still manually trigger draft status changes
  • Real-time Updates: Local interface updates to reflect the new status

Usage Examples

Basic Schedule Field

{
  "interface": "schedule",
  "options": {
    "startDateField": "event_start",
    "endDateField": "event_end",
    "showTime": true,
    "required": true
  }
}

With Draft Mode Enabled

{
  "interface": "schedule",
  "options": {
    "startDateField": "meeting_start",
    "endDateField": "meeting_end",
    "showTime": true,
    "collection": "meeting_drafts",
    "enableDraftMode": true,
    "cronInterval": 300000,
    "autoDraftOnEnd": true
  }
}

Note: The collection field now uses a system collection list interface, allowing you to select from available collections in your Directus instance instead of typing the collection name manually.

Validation Rules

  • None: No validation applied
  • End date must be after start date: Ensures logical date ordering
  • Start date must be in the future: Prevents scheduling in the past
  • Both validations: Applies both validation rules

Display Formats

  • Short: Jan 7, 2025
  • Medium: January 7, 2025
  • Long: Mon, January 7, 2025
  • Numeric: 04/08/2025
  • European: 07.01.2025
  • ISO: 2025-01-07

Browser Compatibility

This extension uses modern JavaScript features and is compatible with:

  • Chrome 88+
  • Firefox 85+
  • Safari 14+
  • Edge 88+

Development

To run in development mode with hot reloading:

npm run dev

Building for Production

npm run build

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

License

MIT License - see LICENSE file for details.