Copied!

Zap Calendar Recurring Date Helper Class

Class to expand recurring rule to a list of dates

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

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

  • var string
public int $interval
 

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

public string $repeatmode
 

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

  • var string
public string $rules
 

rules string

public int $startdate
 

start date in Unix Timestamp format (local timezone)

  • var int
public string $tzid
 

timezone of event (using PHP timezones)

  • var string
public int $until
 

repeat until date (in UTC Unix Timestamp format)

  • var int
public int $weekstart
 

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 $exdates array of exception dates
  • param string $tzid timezone of event (using PHP timezones)
public bySetPos ( array $bytype , array $bysetpos ) : array
 

bysetpos rule support

public debug ( int $level , string $msg ) : self
 

display debug message

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

Get array of dates from recurring rule

  • param $maxdate integer maximum date to appear in repeating dates in Unix timestamp format
  • throws Exception
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
 
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 array $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 array $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 array $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 array $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 array $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 array $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 array $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 array $rdates array of repeating dates
© 2022 Bruce Wells
Search Namespaces \ Classes
Configuration