CalendarData#
A named working-time calendar. Calendars go in ProjectData::calendars; tasks and resources point at them by id through their calendar_id fields. Build it with a struct literal.
Declaration#
Fields#
| Field | Type | Default | Description |
|---|---|---|---|
id |
Id |
required | Calendar id, unique among the project's calendars. "global" replaces the built-in default calendar (Monday to Friday, 08:00-12:00 and 13:00-17:00). |
worktime |
Option<Worktime> |
None |
Working hours, weekdays and date exceptions. None gives the built-in hours and weekdays with no exceptions. |
id#
pub id: Id
The key that TaskData::calendar_id and ResourceData::calendar_id refer to. Without a calendar named "global", the project still has one: the built-in Monday to Friday, 08:00-12:00 and 13:00-17:00.
worktime#
pub worktime:
When the calendar works. None is the same as Some(Worktime::default()).
Errors#
A calendar fails validation with Error::Input at the path calendars[i] when:
- its
idrepeats the id of an earlier calendar in the list - its
worktimeleaves no working time at all
Errors inside worktime are reported at calendars[i].worktime...; see Worktime and TimeRange.
To change a calendar, see SchedulingChanges.
Example#
A project-wide calendar that works Monday to Friday, 09:00-17:00, with one holiday, and a second calendar that keeps the default hours but works Saturdays:
use BTreeMap;
use NaiveDate;
use ;
NaiveDate comes from chrono (cargo add chrono).
For choosing which calendar a task or assignment works on, see Working time and calendars.
Related#
CalendarMode- decides whether task or resource calendars place the workDayRule- a date exception inside a calendar's worktimeTaskData- tasks select a calendar throughcalendar_id- Working time and calendars - defining calendars and assigning them to tasks and resources