GraphReFlyTS

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

ParameterTypeDescription
scheduleCronScheduleParsed cron schedule to match against.
dateDateDate to test.
optsCronMatchOptionsOptional timezone override.

Returns

true when the date satisfies all cron fields.

Example

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

Source

packages/ts/src/graph/sources.ts