Path: blob/master/src/applications/calendar/parser/data/PhutilCalendarDateTime.php
12262 views
<?php12abstract class PhutilCalendarDateTime3extends Phobject {45private $viewerTimezone;6private $isAllDay = false;78public function setViewerTimezone($viewer_timezone) {9$this->viewerTimezone = $viewer_timezone;10return $this;11}1213public function getViewerTimezone() {14return $this->viewerTimezone;15}1617public function setIsAllDay($is_all_day) {18$this->isAllDay = $is_all_day;19return $this;20}2122public function getIsAllDay() {23return $this->isAllDay;24}2526public function getEpoch() {27$datetime = $this->newPHPDateTime();28return (int)$datetime->format('U');29}3031public function getISO8601() {32$datetime = $this->newPHPDateTime();3334if ($this->getIsAllDay()) {35return $datetime->format('Ymd');36} else if ($this->getTimezone()) {37// With a timezone, the event occurs at a specific second universally.38// We return the UTC representation of that point in time.39$datetime->setTimezone(new DateTimeZone('UTC'));40return $datetime->format('Ymd\\THis\\Z');41} else {42// With no timezone, events are "floating" and occur at local time.43// We return a representation without the "Z".44return $datetime->format('Ymd\\THis');45}46}4748abstract public function newPHPDateTimeZone();49abstract public function newPHPDateTime();50abstract public function newAbsoluteDateTime();5152abstract public function getTimezone();53}545556