Changeset View
Changeset View
Standalone View
Standalone View
src/applications/calendar/storage/PhabricatorCalendarEvent.php
Show First 20 Lines • Show All 587 Lines • ▼ Show 20 Lines | public function renderEventDate( | ||||
$start = $this->newStartDateTime(); | $start = $this->newStartDateTime(); | ||||
$end = $this->newEndDateTime(); | $end = $this->newEndDateTime(); | ||||
if ($show_end) { | if ($show_end) { | ||||
$min_date = $start->newPHPDateTime(); | $min_date = $start->newPHPDateTime(); | ||||
$max_date = $end->newPHPDateTime(); | $max_date = $end->newPHPDateTime(); | ||||
// Subtract one second since the stored date is exclusive. | |||||
$max_date = $max_date->modify('-1 second'); | |||||
$min_day = $min_date->format('Y m d'); | $min_day = $min_date->format('Y m d'); | ||||
$max_day = $max_date->format('Y m d'); | $max_day = $max_date->format('Y m d'); | ||||
$show_end_date = ($min_day != $max_day); | $show_end_date = ($min_day != $max_day); | ||||
} else { | } else { | ||||
$show_end_date = false; | $show_end_date = false; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 240 Lines • ▼ Show 20 Lines | final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO | ||||
} | } | ||||
public function newEndDateTime() { | public function newEndDateTime() { | ||||
$datetime = $this->newEndDateTimeForEdit(); | $datetime = $this->newEndDateTimeForEdit(); | ||||
// If this is an all day event, we move the end date time forward to the | // 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 | // 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. | // expect: an all day event from "Nov 1" to "Nov 1" lasts the entire day. | ||||
if ($this->getIsAllDay()) { | |||||
// For imported events, the end date is already stored with this | |||||
// adjustment. | |||||
if ($this->getIsAllDay() && !$this->isImportedEvent()) { | |||||
$datetime = $datetime | $datetime = $datetime | ||||
->newAbsoluteDateTime() | ->newAbsoluteDateTime() | ||||
->setHour(0) | ->setHour(0) | ||||
->setMinute(0) | ->setMinute(0) | ||||
->setSecond(0) | ->setSecond(0) | ||||
->newRelativeDateTime('P1D') | ->newRelativeDateTime('P1D') | ||||
->newAbsoluteDateTime(); | ->newAbsoluteDateTime(); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 518 Lines • Show Last 20 Lines |