schedule#
Schedules a ProjectData snapshot once and returns the result. The call is stateless: it creates a temporary Project with default options, calls solve on it, and disposes it. Nothing is kept between calls. To keep the baseline for later previews or edits, use Project#solve.
Signature#
Synchronous. Runs on the calling thread. The same data and options always produce the same dates.
Parameters#
| Name | Type | Description |
|---|---|---|
data |
ProjectData |
The full snapshot to schedule. Never mutated. |
options |
SolveOptions |
Optional. What to schedule and what to report. Default {}: the whole project. |
data is always validated in "strict" mode. For "repair" mode, create a Project with validation: "repair" and call solve on it.
Returns#
A ScheduleResult, a fresh object that shares nothing with data.
baselineId is set, but it names the baseline of the temporary project, so no later call can use it.
schedule() always returns dates as "YYYY-MM-DD HH:MM" strings. To get local Date objects, create a Project with dates: "date" and call solve on it.
Errors#
| Error | When |
|---|---|
InputError |
data or options fails parsing or strict validation; kind, message and path name the field. Also thrown for a non-finite number or an invalid Date in the input. |
TypeError |
The input has a circular reference or a BigInt. |
schedule never throws ProjectError: each call starts from a fresh project.
Example#
const = ;
Related#
Project#solve- the stateful call that keeps the baselineProjectData- the input snapshotSolveOptions- the optionsScheduleResult- the returned result- Scheduling a Project - one-shot scheduling vs a live project