Tribe__Tickets__Ticket_Object::get_event_timezone()

Return a DateTimeZone associated with the parent Event of the current ticket


Return

(DateTimeZone|null)


Top ↑

Source

File: src/Tribe/Ticket_Object.php

		public function get_event_timezone() {
			if (
				class_exists( 'Tribe__Events__Timezones' )
				&& ! is_null( $this->get_event_id() )
				&& is_null( $this->event_timezone )
			) {
				try {
					$this->event_timezone = new DateTimeZone( Tribe__Events__Timezones::get_event_timezone_string( $this->get_event_id() ) );
				} catch ( Exception $exception ) {
					$this->event_timezone = null;
				}
			}

			if ( null === $this->event_timezone ) {
				$wp_timezone = Tribe__Timezones::wp_timezone_string();
				if ( Tribe__Timezones::is_utc_offset( $wp_timezone ) ) {
					$wp_timezone = Tribe__Timezones::generate_timezone_string_from_utc_offset( $wp_timezone );
				}
				$this->event_timezone = new DateTimeZone( $wp_timezone );
			}

			return $this->event_timezone;
		}

Top ↑

Changelog

Changelog
Version Description
4.7.1 Introduced.