Skip to main content

Function: parseSchedule()

function parseSchedule(schedule): ParsedSchedule;

Defined in: packages/client/src/core/job-engine/schedule.ts:71

Reads a schedule string, or returns null when it is not one.

null is a value the scheduler acts on rather than an error to throw: a job document carrying a schedule nobody can parse should be skipped and reported, not allowed to take down the tick that would have run the other jobs.

Parameters

ParameterType
schedulestring

Returns

ParsedSchedule

Example

parseSchedule("@every 6h"); // { kind: "interval", periodMs: 21600000, ... }
parseSchedule("@daily@09:00"); // { kind: "daily", minutes: 540, ... }
parseSchedule("0 9 * * *"); // null — cron is not accepted, see the module docblock