Skip to content

Abstract Class EventDateHelper

Helper class for working with event dates.

Methods

formatDate

Formats the date (and times, unless all day) of an EventDate or one of its occurrences.

A repeating EventDate is formatted from its first start to its last end (or only its first start if it repeats forever), with the times of each occurrence. All day dates are formatted without times (or as "All day" for the time formats), and aren't converted to the given timezone.

public static formatDate(EventDate|Recurrence $event, DateFormat|string $format = \boundstate\eventful\enums\DateFormat::MEDIUM, ?string $timezone = null, ?bool $allDay = null, bool $displayTimezone = false): string
$event EventDate|Recurrence
$format DateFormat|string A format or its value (e.g. 'mediumDate')
$timezone ?string
$allDay ?bool Whether a Recurrence that isn't an {@link Occurrence} is all day
$displayTimezone bool
return string
throws InvalidArgumentException if the format isn't valid

formatDateRange

Formats the value of an EventDate field.

Deprecated

in 2.2.0. Use formatDate() instead.

public static formatDateRange(EventDate $event, DateFormat|string $format = \boundstate\eventful\enums\DateFormat::MEDIUM, ?string $timezone = null, bool $displayTimezone = false): string
$event EventDate
$format DateFormat|string
$timezone ?string
$displayTimezone bool
return string