export async function cron({
expression,
lastRunAt,
timezone,
_debugNow,
}: {
expression: string;
lastRunAt: Date;
timezone?: string;
_debugNow?: Date;
}) {
const { default: parser } = await import("npm:cron-parser");
const interval = parser.parseExpression(expression, {
tz: timezone,
currentDate: _debugNow,
});
return interval.prev().toDate() >= lastRunAt;
}