Skip to content
PACKAGES

matchesCron()

Test whether a date matches a parsed cron schedule.

import { matchesCron } from "@graphrefly/ts/sources";
function matchesCron(
schedule: CronSchedule,
date: Date,
opts: CronMatchOptions = {},
): boolean
ParameterTypeDescription
scheduleCronScheduleParsed cron schedule to match against.
dateDateDate to test.
optsCronMatchOptionsOptional timezone override.

true when the date satisfies all cron fields.

matchesCron(parseCron("0 * * * *"), new Date());

packages/ts/src/graph/sources.ts