Recurrence
- class gcsa.recurrence.Duration(w=None, d=None, h=None, m=None, s=None)
Represents properties that contain a duration of time.
- Parameters:
w – weeks
d – days
h – hours
m – minutes
s – seconds
- class gcsa.recurrence.Recurrence
- static rule(freq='DAILY', interval=None, count=None, until=None, by_second=None, by_minute=None, by_hour=None, by_week_day=None, by_month_day=None, by_year_day=None, by_week=None, by_month=None, by_set_pos=None, week_start=<gcsa.recurrence._DayOfTheWeek object>)
This property defines a rule or repeating pattern for recurring events.
- Parameters:
freq – Identifies the type of recurrence rule. Possible values are SECONDLY, HOURLY, MINUTELY, DAILY, WEEKLY, MONTHLY, YEARLY. Default: DAILY
interval – Positive integer representing how often the recurrence rule repeats
count – Number of occurrences at which to range-bound the recurrence
until – End date of recurrence
by_second – Second or list of seconds within a minute. Valid values are 0 to 60
by_minute – Minute or list of minutes within a hour. Valid values are 0 to 59
by_hour – Hour or list of hours of the day. Valid values are 0 to 23
by_week_day – Day or list of days of the week. Possible values:
SUNDAY
,MONDAY
,TUESDAY
,WEDNESDAY
,THURSDAY
,FRIDAY
,SATURDAY
by_month_day – Day or list of days of the month. Valid values are 1 to 31 or -31 to -1. For example, -10 represents the tenth to the last day of the month.
by_year_day – Day or list of days of the year. Valid values are 1 to 366 or -366 to -1. For example, -1 represents the last day of the year.
by_week – Ordinal or list of ordinals specifying weeks of the year. Valid values are 1 to 53 or -53 to -1.
by_month – Month or list of months of the year. Valid values are 1 to 12.
by_set_pos – Value or list of values which corresponds to the nth occurrence within the set of events specified by the rule. Valid values are 1 to 366 or -366 to -1. It can only be used in conjunction with another by_xxx parameter.
week_start – The day on which the workweek starts. Possible values:
SUNDAY
,MONDAY
,TUESDAY
,WEDNESDAY
,THURSDAY
,FRIDAY
,SATURDAY
- Returns:
String representing specified recurrence rule in RRULE format.
Note
If none of the by_day, by_month_day, or by_year_day are specified, the day is gotten from start date.
- static exclude_rule(freq='DAILY', interval=None, count=None, until=None, by_second=None, by_minute=None, by_hour=None, by_week_day=None, by_month_day=None, by_year_day=None, by_week=None, by_month=None, by_set_pos=None, week_start=<gcsa.recurrence._DayOfTheWeek object>)
This property defines an exclusion rule or repeating pattern for recurring events.
- Parameters:
freq – Identifies the type of recurrence rule. Possible values are SECONDLY, HOURLY, MINUTELY, DAILY, WEEKLY, MONTHLY, YEARLY. Default: DAILY
interval – Positive integer representing how often the recurrence rule repeats
count – Number of occurrences at which to range-bound the recurrence
until – End date of recurrence
by_second – Second or list of seconds within a minute. Valid values are 0 to 60
by_minute – Minute or list of minutes within a hour. Valid values are 0 to 59
by_hour – Hour or list of hours of the day. Valid values are 0 to 23
by_week_day – Day or list of days of the week. Possible values:
SUNDAY
,MONDAY
,TUESDAY
,WEDNESDAY
,THURSDAY
,FRIDAY
,SATURDAY
by_month_day – Day or list of days of the month. Valid values are 1 to 31 or -31 to -1. For example, -10 represents the tenth to the last day of the month.
by_year_day – Day or list of days of the year. Valid values are 1 to 366 or -366 to -1. For example, -1 represents the last day of the year.
by_week – Ordinal or list of ordinals specifying weeks of the year. Valid values are 1 to 53 or -53 to -1.
by_month – Month or list of months of the year. Valid values are 1 to 12.
by_set_pos – Value or list of values which corresponds to the nth occurrence within the set of events specified by the rule. Valid values are 1 to 366 or -366 to -1. It can only be used in conjunction with another by_xxx parameter.
week_start – The day on which the workweek starts. Possible values:
SUNDAY
,MONDAY
,TUESDAY
,WEDNESDAY
,THURSDAY
,FRIDAY
,SATURDAY
- Returns:
String representing specified recurrence rule in RRULE format.
Note
If none of the by_day, by_month_day, or by_year_day are specified, the day is gotten from start date.
- static dates(ds)
Converts date(s) set to RDATE format.
- Parameters:
ds – date/datetime object or list of date/datetime objects
- Returns:
RDATE string of dates.
- static times(dts, timezone='Etc/UTC')
Converts datetime(s) set to RDATE format.
- Parameters:
dts – datetime object or list of datetime objects
timezone – Timezone formatted as an IANA Time Zone Database name, e.g. “Europe/Zurich”. By default, the computers local timezone is used if it is configured. UTC is used otherwise.
- Returns:
RDATE string of datetimes with specified timezone.
- static periods(ps, timezone='Etc/UTC')
Converts date period(s) to RDATE format.
- Period is defined as tuple of starting date/datetime and ending date/datetime or duration as Duration object:
(date/datetime, date/datetime/Duration)
- Parameters:
ps – Period or list of periods.
timezone – Timezone formatted as an IANA Time Zone Database name, e.g. “Europe/Zurich”. By default, the computers local timezone is used if it is configured. UTC is used otherwise.
- Returns:
RDATE string of periods.
- static exclude_dates(ds)
Converts date(s) set to EXDATE format.
- Parameters:
ds – date/datetime object or list of date/datetime objects
- Returns:
EXDATE string of dates.
- static exclude_times(dts, timezone='Etc/UTC')
Converts datetime(s) set to EXDATE format.
- Parameters:
dts – datetime object or list of datetime objects
timezone – Timezone formatted as an IANA Time Zone Database name, e.g. “Europe/Zurich”. By default, the computers local timezone is used if it is configured. UTC is used otherwise.
- Returns:
EXDATE string of datetimes with specified timezone.
- static exclude_periods(ps, timezone='Etc/UTC')
Converts date period(s) to EXDATE format.
- Period is defined as tuple of starting date/datetime and ending date/datetime or duration as Duration object:
(date/datetime, date/datetime/Duration)
- Parameters:
ps – Period or list of periods.
timezone – Timezone formatted as an IANA Time Zone Database name, e.g. “Europe/Zurich”. By default, the computers local timezone is used if it is configured. UTC is used otherwise.
- Returns:
EXDATE string of periods.