Copied!

Zap Calendar Recurring Date Helper Class

Class to expand recurring rule to a list of dates

CloneableInstantiable
Properties
public array $byday = []
 
  • var array<int,string> of repeat by day values
public array $byhour = []
 
  • var array<int,string> of repeat by hour values
public array $byminute = []
 
  • var array<int,string> of repeat by minutes values
public array $bymonth = []
 
  • var array<int,string> of repeat by month values
public array $bymonthday = []
 
  • var array<int,string> of repeat by month day values
public array $bysecond = []
 
  • var array<int,string> of repeat by seconds values
public array $bysetpos = []
 
  • var array<int,string> of repeat by setpos values
public array $byyear = []
 
  • var array<int,string> of repeat by year values
public int $count = 0
 
  • var int $count repeat count when repeat mode is 'c'
public int $debug = 0
 
  • var int $debug debug level (for testing only)
public string $error = ''
 
  • var string $error error string (future use)
public array $exdates = []
 
  • var array<int,int> of exception dates in Unix Timestamp format (UTC dates)
public ?string $freq = NULL
 

repeating frequency type (i.e. 'y' for yearly, 'm' for monthly)

public int $interval = 1
 

inteval of repeating event (i.e. every 2 weeks, every 6 months)

public ?string $repeatmode = NULL
 

repeat mode ('c': count, 'u': until)

public string $rules = ''
 

rules string

public ?int $startdate = NULL
 

start date in Unix Timestamp format (local timezone)

public ?string $tzid = NULL
 

timezone of event (using PHP timezones)

public ?int $until = NULL
 

repeat until date (in UTC Unix Timestamp format)

  • var int $until UTC Unix Timestamp
public ?int $weekstart = NULL
 

start of week number (i.e. 0 for Sunday, 5 for Friday)

  • var ?int
Methods
public __construct(string $rules, int $startdate, array $exdates = [], string $tzid = 'UTC')
 

Expand recurring rule to a list of dates

  • param string $rules iCalendar rules string
  • param int $startdate start date in Unix Timestamp format
  • param array<int,int> $exdates array of exception dates
  • param string $tzid timezone of event (using PHP timezones)
public bySetPos(array $bytype, array $bysetpos) : array
 

bysetpos rule support

  • param array<int,string> $bytype
  • param array<int,string> $bysetpos
  • return array<int,string>
public debug(int $level, string $msg) : self
 

display debug message

public getDates(?int $maxdate = NULL) : array
 

Get array of dates from recurring rule

  • param mixed $maxdate integer maximum date to appear in repeating dates in Unix timestamp format
  • throws \Exception
  • return int[]
public getError() : string
 

get error message

  • return string error message
public setDebug(int $level) : self
 

set debug level (0: none, 1: minimal, 2: more output)

public setError(string $msg) : self
 

save error

Properties
private int $maxYear
 

Max year supported

Methods
private byDay(int $startdate, int $enddate, array $rdates, string $tzid = 'UTC') : int
 

Get repeating dates by day

  • param int $startdate start date of repeating events, in Unix timestamp format
  • param int $enddate end date of repeating events, in Unix timestamp format
  • param int[] $rdates array to contain expanded repeating dates
  • param string $tzid timezone of event (using PHP timezones)
  • return int count of dates
private byHour(int $startdate, int $enddate, array $rdates, string $tzid = 'UTC') : int
 

Get repeating dates by hour

  • param int $startdate start date of repeating events, in Unix timestamp format
  • param int $enddate end date of repeating events, in Unix timestamp format
  • param int[] $rdates array to contain expanded repeating dates
  • param string $tzid timezone of event (using PHP timezones)
  • return int count of dates
private byMinute(int $startdate, int $enddate, array $rdates, string $tzid = 'UTC') : int
 

Get repeating dates by minute

  • param int $startdate start date of repeating events, in Unix timestamp format
  • param int $enddate end date of repeating events, in Unix timestamp format
  • param int[] $rdates array to contain expanded repeating dates
  • param string $tzid timezone of event (using PHP timezones)
  • return int count of dates
private byMonth(int $startdate, int $enddate, array $rdates, string $tzid = 'UTC') : int
 

Get repeating dates by month

  • param int $startdate start date of repeating events, in Unix timestamp format
  • param int $enddate end date of repeating events, in Unix timestamp format
  • param int[] $rdates array to contain expanded repeating dates
  • param string $tzid timezone of event (using PHP timezones)
  • return int count of dates
private byMonthDay(int $startdate, int $enddate, array $rdates, string $tzid = 'UTC') : int
 

Get repeating dates by month day

  • param int $startdate start date of repeating events, in Unix timestamp format
  • param int $enddate end date of repeating events, in Unix timestamp format
  • param int[] $rdates array to contain expanded repeating dates
  • param string $tzid timezone of event (using PHP timezones)
  • return int count of dates
private bySecond(int $startdate, int $enddate, array $rdates, string $tzid = 'UTC') : int
 

Get repeating dates by second

  • param int $startdate start date of repeating events, in Unix timestamp format
  • param int $enddate end date of repeating events, in Unix timestamp format
  • param int[] $rdates array to contain expanded repeating dates
  • param string $tzid timezone of event (using PHP timezones)
  • return int count of dates
private byYear(int $startdate, int $enddate, array $rdates, string $tzid = 'UTC') : int
 

Get repeating dates by year

  • param int $startdate start date of repeating events, in Unix timestamp format
  • param int $enddate end date of repeating events, in Unix timestamp format
  • param int[] $rdates array to contain expanded repeating dates
  • param string $tzid timezone of event (using PHP timezones)
  • return int count of dates
private maxDates(array $rdates) : bool
 

Determine if the loop has reached the end date

  • param int[] $rdates array of repeating dates
© 2025 Bruce Wells
Search Namespaces \ Classes
Configuration