public function applyInternalEffects($object, $value) { $actor = $this->getActor(); $editor = $this->getEditor(); $datetime = PhutilCalendarAbsoluteDateTime::newFromDictionary($value); $datetime->setIsAllDay($editor->getNewIsAllDay()); $object->setEndDateTime($datetime); }
public function applyInternalEffects($object, $value) { $object->setIsAllDay($value); // Adjust the flags on any other dates the event has. $keys = array('startDateTime', 'endDateTime', 'untilDateTime'); foreach ($keys as $key) { $dict = $object->getParameter($key); if (!$dict) { continue; } $datetime = PhutilCalendarAbsoluteDateTime::newFromDictionary($dict); $datetime->setIsAllDay($value); $object->setParameter($key, $datetime->toDictionary()); } }
private function newDateTimeFromDictionary(array $dict) { $datetime = PhutilCalendarAbsoluteDateTime::newFromDictionary($dict); return $this->newDateTimeFromDateTime($datetime); }
protected final function renderDate($epoch) { $viewer = $this->getViewer(); // We accept either epoch timestamps or dictionaries describing a // PhutilCalendarDateTime. if (is_array($epoch)) { $datetime = PhutilCalendarAbsoluteDateTime::newFromDictionary($epoch)->setViewerTimezone($viewer->getTimezoneIdentifier()); $all_day = $datetime->getIsAllDay(); $epoch = $datetime->getEpoch(); } else { $all_day = false; } if ($all_day) { $display = phabricator_date($epoch, $viewer); } else { $display = phabricator_datetime($epoch, $viewer); // When rendering to text, we explicitly render the offset from UTC to // provide context to the date: the mail may be generating with the // server's settings, or the user may later refer back to it after // changing timezones. if ($this->isTextMode()) { $offset = $viewer->getTimeZoneOffsetInHours(); if ($offset >= 0) { $display = pht('%s (UTC+%d)', $display, $offset); } else { $display = pht('%s (UTC-%d)', $display, abs($offset)); } } } return $this->renderValue($display); }