Files
fn_registry/functions/core/cron_match.go
T
egutierrez 3136eb862f feat: add DAG core functions — parse, validate, topo sort, resolve env, cron match (0007a, 0007d)
Pure functions for parsing dagu-compatible YAML, validating DAG structure,
topological sorting with parallel levels (Kahn's algorithm), and env variable
resolution. Also adds cron_match for schedule matching.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 13:05:05 +02:00

13 lines
360 B
Go

package core
import "time"
// CronMatch returns true if time t matches all fields of the cron schedule.
func CronMatch(sched CronSchedule, t time.Time) bool {
return intIn(t.Minute(), sched.Minute) &&
intIn(t.Hour(), sched.Hour) &&
intIn(t.Day(), sched.DayOfMonth) &&
intIn(int(t.Month()), sched.Month) &&
intIn(int(t.Weekday()), sched.DayOfWeek)
}