Skip to content

enhancement: add human-readable schedule description #205

@CybotTM

Description

@CybotTM

Description

Users may want to display cron schedules in human-readable format for UIs or logs.

Current Limitation

entry := c.Entry(id)
fmt.Println(entry.Schedule)  // Just prints struct, not useful

Proposed Enhancement

// Method on Schedule interface
type Schedule interface {
    Next(time.Time) time.Time
    Description() string  // New method
}

// Usage
entry := c.Entry(id)
desc := entry.Schedule.Description()
// Returns: "Every 5 minutes" or "At 2:30 AM on weekdays"

// Standalone function for specs
desc := cron.DescribeSpec("0 30 2 * * MON-FRI")
// Returns: "At 2:30 AM, Monday through Friday"

Examples

Spec Description
* * * * * Every minute
0 * * * * Every hour
0 0 * * * Every day at midnight
0 0 1 * * First day of every month at midnight
*/15 * * * * Every 15 minutes
0 9-17 * * MON-FRI Every hour from 9 AM to 5 PM, Monday to Friday

Severity

🟢 Low - UX improvement

Found By

Pre-1.0 release code review with Zen/Gemini

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiAPI design changesenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions