public function FullCalendar::updateEventTimezone in FullCalendar 8.5
Same name and namespace in other branches
- 8.2 src/Plugin/views/style/FullCalendar.php \Drupal\fullcalendar\Plugin\views\style\FullCalendar::updateEventTimezone()
- 8.4 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\styleCode
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);
}