Changeset View
Changeset View
Standalone View
Standalone View
src/applications/calendar/storage/PhabricatorCalendarEvent.php
Show First 20 Lines • Show All 851 Lines • ▼ Show 20 Lines | public function newStartDateTime() { | ||||
$epoch = $this->getDateFrom(); | $epoch = $this->getDateFrom(); | ||||
return $this->newDateTimeFromEpoch($epoch); | return $this->newDateTimeFromEpoch($epoch); | ||||
} | } | ||||
public function getStartDateTimeEpoch() { | public function getStartDateTimeEpoch() { | ||||
return $this->newStartDateTime()->getEpoch(); | return $this->newStartDateTime()->getEpoch(); | ||||
} | } | ||||
public function newEndDateTime() { | public function newEndDateTimeForEdit() { | ||||
$datetime = $this->getParameter('endDateTime'); | $datetime = $this->getParameter('endDateTime'); | ||||
if ($datetime) { | if ($datetime) { | ||||
return $this->newDateTimeFromDictionary($datetime); | return $this->newDateTimeFromDictionary($datetime); | ||||
} | } | ||||
$epoch = $this->getDateTo(); | $epoch = $this->getDateTo(); | ||||
return $this->newDateTimeFromEpoch($epoch); | return $this->newDateTimeFromEpoch($epoch); | ||||
} | } | ||||
public function newEndDateTime() { | |||||
$datetime = $this->newEndDateTimeForEdit(); | |||||
// If this is an all day event, we move the end date time forward to the | |||||
// first second of the following day. This is consistent with what users | |||||
// expect: an all day event from "Nov 1" to "Nov 1" lasts the entire day. | |||||
if ($this->getIsAllDay()) { | |||||
$datetime = $datetime | |||||
->newAbsoluteDateTime() | |||||
->setHour(0) | |||||
->setMinute(0) | |||||
->setSecond(0) | |||||
->newRelativeDateTime('P1D') | |||||
->newAbsoluteDateTime(); | |||||
} | |||||
return $datetime; | |||||
} | |||||
public function getEndDateTimeEpoch() { | public function getEndDateTimeEpoch() { | ||||
return $this->newEndDateTime()->getEpoch(); | return $this->newEndDateTime()->getEpoch(); | ||||
} | } | ||||
public function newUntilDateTime() { | public function newUntilDateTime() { | ||||
$datetime = $this->getParameter('untilDateTime'); | $datetime = $this->getParameter('untilDateTime'); | ||||
if ($datetime) { | if ($datetime) { | ||||
return $this->newDateTimeFromDictionary($datetime); | return $this->newDateTimeFromDictionary($datetime); | ||||
▲ Show 20 Lines • Show All 430 Lines • Show Last 20 Lines |