Page MenuHomePhabricator

D16777.id40413.diff
No OneTemporary

D16777.id40413.diff

diff --git a/src/applications/calendar/editor/PhabricatorCalendarEventEditEngine.php b/src/applications/calendar/editor/PhabricatorCalendarEventEditEngine.php
--- a/src/applications/calendar/editor/PhabricatorCalendarEventEditEngine.php
+++ b/src/applications/calendar/editor/PhabricatorCalendarEventEditEngine.php
@@ -119,7 +119,7 @@
->setDescription(pht('End time of the event.'))
->setConduitDescription(pht('Change the end time of the event.'))
->setConduitTypeDescription(pht('New event end time.'))
- ->setValue($object->getEndDateTimeEpoch()),
+ ->setValue($object->newEndDateTimeForEdit()->getEpoch()),
id(new PhabricatorBoolEditField())
->setKey('cancelled')
->setOptions(pht('Active'), pht('Cancelled'))
diff --git a/src/applications/calendar/storage/PhabricatorCalendarEvent.php b/src/applications/calendar/storage/PhabricatorCalendarEvent.php
--- a/src/applications/calendar/storage/PhabricatorCalendarEvent.php
+++ b/src/applications/calendar/storage/PhabricatorCalendarEvent.php
@@ -857,7 +857,7 @@
return $this->newStartDateTime()->getEpoch();
}
- public function newEndDateTime() {
+ public function newEndDateTimeForEdit() {
$datetime = $this->getParameter('endDateTime');
if ($datetime) {
return $this->newDateTimeFromDictionary($datetime);
@@ -867,6 +867,25 @@
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() {
return $this->newEndDateTime()->getEpoch();
}
diff --git a/src/applications/calendar/xaction/PhabricatorCalendarEventEndDateTransaction.php b/src/applications/calendar/xaction/PhabricatorCalendarEventEndDateTransaction.php
--- a/src/applications/calendar/xaction/PhabricatorCalendarEventEndDateTransaction.php
+++ b/src/applications/calendar/xaction/PhabricatorCalendarEventEndDateTransaction.php
@@ -7,7 +7,7 @@
public function generateOldValue($object) {
// TODO: Upgrade this.
- return $object->getEndDateTimeEpoch();
+ return $object->newEndDateTimeForEdit()->getEpoch();
}
public function applyInternalEffects($object, $value) {

File Metadata

Mime Type
text/plain
Expires
Wed, Mar 12, 9:29 PM (1 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7263954
Default Alt Text
D16777.id40413.diff (2 KB)

Event Timeline