DayRule#
Working time of one calendar date. A DayRule is the value type of Worktime::dates, keyed by chrono::NaiveDate. On that date the rule replaces the weekday rule from Worktime::days, in both directions: it can turn a working weekday off or a weekend day on.
Declaration#
Variants#
| Variant | Description |
|---|---|
Off |
Non-working date, such as a holiday. |
On |
Working date with the calendar's regular hours (Worktime::hours). |
Hours(Vec<TimeRange>) |
Working date with these hours instead of the regular ones. An empty list works like Off. |
The ranges in Hours follow the TimeRange rules. An invalid range is rejected with Error::Input at the path calendars[i].worktime.dates[YYYY-MM-DD].
Example#
A calendar with a holiday, a working Saturday and a short day:
use BTreeMap;
use NaiveDate;
use ;
The example uses chrono for the date keys, so add it next to the library: cargo add chrono.
Related#
Worktime- holds the date exceptions keyed by dateTimeRange- the working intervals of anHoursruleCalendarData- the calendar the exception belongs to- Working time and calendars - holidays and working days off the regular week