Time Object

class activelogic.TimeObject

Object representing different aspects of time.

This object can be used to match on any combination of date and time range, or time range for specific days of the week.

TimeObject uses datetime module to store date and time.

>>> from datetime import datetime, timedelta
>>> # Fixed date/time interval
>>> start = datetime.fromisoformat('2021-09-06 08:00')
>>> obj = rs.add(TimeObject('myobj', items=[
...     (start, start + timedelta(days=5))
... ]))
>>> from datetime import time
>>> # Weekdays 8-11 and 13-17, local time
>>> obj = rs.add(TimeObject('myobj', items=[
...     (TimeObjectDayMask.WEEKDAYS, time(8), time(11)),
...     (TimeObjectDayMask.WEEKDAYS, time(13), time(17))
... ]))
class activelogic.TimeObjectDayMask

Defines a set of constants where each one represents a day or set of days.

Variables
  • MON – Monday

  • TUE – Tuesday

  • WED – Wednesday

  • THU – Thursday

  • FRI – Friday

  • SAT – Saturday

  • SUN – Sunday

  • WEEKDAYS – Monday - Friday

class activelogic.TimeObjectDayTimeItem

Item representing a weekly recurring time interval.

Parameters
  • days (TimeObjectDayMask) – Days of the week

  • from_time (datetime.time) – Start time

  • to_time (datetime.time) – End time

class activelogic.TimeObjectDateRangeItem

Item representing a date and time range.

Parameters
  • from_date (datetime.datetime) – Start time

  • to_date (datetime.datetime) – End time