TimeRange#
One interval of working hours within a day. A calendar's daily hours are a list of these ranges: Worktime::hours for the regular week and DayRule::Hours for a date exception. There's no constructor; build it with a struct literal.
Declaration#
Fields#
start#
pub start: u16
Start of the range in minutes since midnight. Valid values are 0 to 1439 (00:00 to 23:59).
end#
pub end: u16
End of the range in minutes since midnight. Valid values are 0 to 1440; 1440 is 24:00.
When end is less than or equal to start, the range crosses midnight: it runs from start to end on the next day and belongs to the day it starts on. { start: 1320, end: 360 } is 22:00 to 06:00. When end equals start, the range covers 24 hours.
A start of 1440 or more, or an end above 1440, fails validation of the ProjectData that holds the calendar. The error is an InputError of kind Validation, with the message hour range must be within 00:00..24:00 and a path such as calendars[0].worktime.hours or calendars[0].worktime.dates[2026-08-14].
Example#
A calendar with a night shift from 22:00 to 06:00:
use ;
Related#
Worktime- holds the regular daily hoursDayRule- sets other hours for one dateCalendarData- the calendar the hours belong to- Working time and calendars - defining working hours, including night shifts