forked from robfig/cron
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
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 usefulProposed 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