Skip to content

Class EventDate

The value of an Event Date field: when an event starts and ends, and how it repeats.

An event that repeats has a Recurr rule built from the repeat attributes (freq, interval, byDay, etc.), which generates its occurrences, along with any inclusion dates (inDates) and minus any exclusion dates (exDates). Dates are in the event's timezone, or the system timezone for all day events.

The rule, occurrences, first start, last end, etc. are cached when they're first read, and modifying the attributes afterwards doesn't update them. Only modify a value before reading any of them (like DefaultController::actionDelete() does), or create a new one.

Extends Model

Constants

FREQ_DAILY

FREQ_WEEKLY

FREQ_MONTHLY

FREQ_YEARLY

ENDS_COUNT

ENDS_UNTIL

DEFAULT_DURATION

Default event duration in minutes, when no end is given (matches the input JS)

Properties

allowNeverEnding

public bool $allowNeverEnding

start

public ?DateTime $start

end

public ?DateTime $end

timezone

public ?string $timezone

allDay

public bool $allDay

repeat

public bool $repeat

interval

public ?int $interval

freq

public ?string $freq

byDay

public array $byDay

byMonthDay

public array $byMonthDay

ends

public ?string $ends

count

public ?int $count

until

public ?DateTime $until

inDates

public array $inDates

exDates

public array $exDates

Methods

__construct

public __construct(mixed $config = []): mixed
$config mixed
return mixed

repeatsForCount

public repeatsForCount(): bool
return bool

repeatsUntil

public repeatsUntil(): bool
return bool

repeatsWeekly

public repeatsWeekly(): bool
return bool

repeatsMonthly

public repeatsMonthly(): bool
return bool

getRule

public getRule(): ?Rule
return ?Rule

rules

public rules(): array
return array

validateUntil

public validateUntil(): void

validateEndDate

public validateEndDate(): void

getRepeatDescription

public getRepeatDescription(): ?string
return ?string

getOccurrences

Returns the occurrences, up to 732 of them (ArrayTransformer::DEFAULT_LIMIT).

Use getOccurrencesInRange() to get later occurrences.

public getOccurrences(?ConstraintInterface $constraint = null): \Recurr\RecurrenceCollection<array-key,Occurrence>
$constraint ?ConstraintInterface
return \Recurr\RecurrenceCollection<array-key,Occurrence>

getNextOccurrence

public getNextOccurrence(bool $includeInProgress = false): ?Occurrence
$includeInProgress bool
return ?Occurrence

getOccurrencesInRange

Returns the occurrences that start in the range (inclusive), or with $includeInProgress, also those that started before the range and end after its start.

public getOccurrencesInRange(DateTimeInterface $start, DateTimeInterface $end, bool $includeInProgress = false): \Recurr\RecurrenceCollection<array-key,Occurrence>
$start DateTimeInterface
$end DateTimeInterface
$includeInProgress bool
return \Recurr\RecurrenceCollection<array-key,Occurrence>

getFirstStartDate

public getFirstStartDate(): ?DateTime
return ?DateTime

getLastEndDate

public getLastEndDate(): ?DateTime
return ?DateTime

isPast

public isPast(): bool
return bool