API Reference
matchesCron()
Test whether a date matches a parsed cron schedule.
Import
import { matchesCron } from "@graphrefly/ts/sources";
Signature
function matchesCron(
schedule: CronSchedule,
date: Date,
opts: CronMatchOptions = {},
): boolean
Parameters
| Parameter | Type | Description |
|---|---|---|
schedule | CronSchedule | Parsed cron schedule to match against. |
date | Date | Date to test. |
opts | CronMatchOptions | Optional timezone override. |
Returns
true when the date satisfies all cron fields.
Example
matchesCron(parseCron("0 * * * *"), new Date());
Source
packages/ts/src/graph/sources.ts