/**
* Overrides prepareTimezone().
*
* Override basic component timezone handling to use Drupal's
* knowledge of the preferred user timezone.
*/
protected function prepareTimezone($timezone) { if (empty($timezone)) { // Fallback to user or system default timezone.
$timezone =
date_default_timezone_get();
} return parent::
prepareTimezone($timezone);
} /**
* Overrides format().
*
* @param string $format
* A format string using either PHP's date().
* @param array $settings
* - timezone: (optional) String timezone name. Defaults to the timezone
* of the date object.
* - langcode: (optional) String two letter language code used to control
* the result of the format() method. Defaults to NULL.
*
* @return string
* The formatted value of the date. Since the format may contain user input,
* this value should be escaped when output.
*/