Schedule
A schedule is used to define a set of time periods during which specific events or activities occur. For instance, it can indicate an employee's working hours, the times when a bicycle is available for rent, or the days when a tourist activity is offered. Schedules are also crucial for determining when particular pricing policies are in effect. For example, the cost of a resource may change depending on whether it is high season or low season. These scenarios exemplify how a schedule object can be used to specify availability and pricing conditions over time.
A schedule is represented as an array of events. Typically, these events will recur based on recurrence rules defined in RFC 5545 and RFC 2445. These rules allow for the detailed specification of repeating time periods, providing precise control over the timing and repetition of events, activities, or pricing conditions within the schedule. This flexibility is essential for accurately modeling complex and varied temporal patterns, whether for employee shifts, rental availability, or dynamic pricing strategies.
Additionally, schedules can accommodate exceptions to these recurrence patterns. For example, a schedule might specify that an event occurs every Tuesday, but with an exception on a particular Tuesday, such as the 31st, which is a holiday. This capability ensures that schedules remain adaptable to real-world variations and special circumstances.
Specs
A schedule is just a subset of the text representation of the ical specification.
Examples
Example 0
Weekly 09:00 - 18:00
BEGIN:VEVENT
RRULE:FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR
DTSTART:20240101T090000
DTEND:20240101T180000
END:VEVENT
In this rule:
BEGIN:VEVENT
andEND:VEVENT
wrap the event definition.RRULE:FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR
specifies a weekly frequency from Monday to Friday.DTSTART:20240101T090000
specifies the start time at 9:00 AM (in the format YYYYMMDDTHHMMSS).DTEND:20240101T180000
specifies the end time at 6:00 PM.
Example 2
Weekly Monday till Friday 09:00 - 15:00, Saturday 09:00 - 16:00, 20:00 - 22:00, Sunday 20:00 - 01:00
BEGIN:VEVENT
RRULE:FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR
DTSTART:20240101T090000
DTEND:20240101T150000
END:VEVENT
BEGIN:VEVENT
RRULE:FREQ=WEEKLY;BYDAY=SA
DTSTART:20240106T090000
DTEND:20240106T160000
END:VEVENT
BEGIN:VEVENT
RRULE:FREQ=WEEKLY;BYDAY=SA
DTSTART:20240106T200000
DTEND:20240106T220000
END:VEVENT
BEGIN:VEVENT
RRULE:FREQ=WEEKLY;BYDAY=SU
DTSTART:20240107T200000
DTEND:20240108T010000
END:VEVENT
In this rule:
BEGIN:VEVENT
andEND:VEVENT
wrap each event definition.- For Monday to Friday,
RRULE:FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR
specifies a weekly frequency from Monday to Friday.DTSTART:20240101T090000
specifies the start time at 9:00 AM.DTEND:20240101T150000
specifies the end time at 3:00 PM.
- For Saturday morning to afternoon,
RRULE:FREQ=WEEKLY;BYDAY=SA
specifies a weekly frequency on Saturday.DTSTART:20240106T090000
specifies the start time at 9:00 AM.DTEND:20240106T160000
specifies the end time at 4:00 PM.
- For Saturday evening,
RRULE:FREQ=WEEKLY;BYDAY=SA
specifies a weekly frequency on Saturday.DTSTART:20240106T200000
specifies the start time at 8:00 PM.DTEND:20240106T220000
specifies the end time at 10:00 PM.
- For Sunday evening,
RRULE:FREQ=WEEKLY;BYDAY=SU
specifies a weekly frequency on Sunday.DTSTART:20240107T200000
specifies the start time at 8:00 PM.DTEND:20240108T010000
specifies the end time at 1:00 AM on Monday.