UNPKG

agenda

Version:

Light weight job scheduler for Node.js

16 lines (14 loc) 393 B
// @ts-expect-error import date from "date.js"; import { Job } from "."; /** * Schedules a job to run at specified time * @name Job#schedule * @function * @param time schedule a job to run "then" */ export const schedule = function (this: Job, time: string | Date): Job { const d = new Date(time); this.attrs.nextRunAt = Number.isNaN(d.getTime()) ? date(time) : d; return this; };