You are here

public function FullCalendar::updateEventTimezone in FullCalendar 8.4

Same name and namespace in other branches
  1. 8.5 src/Plugin/views/style/FullCalendar.php \Drupal\fullcalendar\Plugin\views\style\FullCalendar::updateEventTimezone()
  2. 8.2 src/Plugin/views/style/FullCalendar.php \Drupal\fullcalendar\Plugin\views\style\FullCalendar::updateEventTimezone()

Update a date with timezone.

Parameters

string $datetime: A datetime string.

string $tz_override: Any timezone override for the date.

Return value

string Formatted datetime with timezone applied. Formatted datetime with timezone applied.

Throws

\Exception

1 call to FullCalendar::updateEventTimezone()
FullCalendar::getEventStartEndDates in src/Plugin/views/style/FullCalendar.php
Get start/end dates for an event.

File

src/Plugin/views/style/FullCalendar.php, line 610

Class

FullCalendar
Plugin annotation @ViewsStyle( id = "fullcalendar", title = @Translation("FullCalendar"), help = @Translation("Displays items on a calendar."), theme = "views_view--fullcalendar", display_types = {"normal"} )

Namespace

Drupal\fullcalendar\Plugin\views\style

Code

public function updateEventTimezone($datetime, $tz_override) {
  $tz = !empty($tz_override) ? $tz_override : date_default_timezone_get();
  $timezone = new \DateTimeZone($tz);
  $dateTimezone = new DateTime($datetime, new \DateTimeZone('UTC'));
  $dateTimezone
    ->setTimezone($timezone);
  return $dateTimezone
    ->format(DateTime::ATOM);
}