@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Make calendar intepret all-day dates in a more consistent way

Summary:
In ICS, an event on "Nov 1" starts on "2016-11-01" and ends on "2016-11-02".

This is convenient for computers, but this isn't what users expect to enter in date controls. They expect to enter "nov 1" to "Nov 1" for a one-day, all-day event. This is consistent with other applications.

Store the value the user entered, but treat it as the first second of the next day when actually using it if the event is an all day event.

Test Plan:
Mucked around with multi-day all-day events, recurring all-day events, imports, etc. Couldn't catch any weird/unintuitive stuff anymore offhand.

(Previously, entering "Nov 1" to "Nov 2" created a one-day event, which was unclear.

Reviewers: chad

Reviewed By: chad

Differential Revision: https://secure.phabricator.com/D16777

+22 -3
+1 -1
src/applications/calendar/editor/PhabricatorCalendarEventEditEngine.php
··· 119 119 ->setDescription(pht('End time of the event.')) 120 120 ->setConduitDescription(pht('Change the end time of the event.')) 121 121 ->setConduitTypeDescription(pht('New event end time.')) 122 - ->setValue($object->getEndDateTimeEpoch()), 122 + ->setValue($object->newEndDateTimeForEdit()->getEpoch()), 123 123 id(new PhabricatorBoolEditField()) 124 124 ->setKey('cancelled') 125 125 ->setOptions(pht('Active'), pht('Cancelled'))
+20 -1
src/applications/calendar/storage/PhabricatorCalendarEvent.php
··· 857 857 return $this->newStartDateTime()->getEpoch(); 858 858 } 859 859 860 - public function newEndDateTime() { 860 + public function newEndDateTimeForEdit() { 861 861 $datetime = $this->getParameter('endDateTime'); 862 862 if ($datetime) { 863 863 return $this->newDateTimeFromDictionary($datetime); ··· 865 865 866 866 $epoch = $this->getDateTo(); 867 867 return $this->newDateTimeFromEpoch($epoch); 868 + } 869 + 870 + public function newEndDateTime() { 871 + $datetime = $this->newEndDateTimeForEdit(); 872 + 873 + // If this is an all day event, we move the end date time forward to the 874 + // first second of the following day. This is consistent with what users 875 + // expect: an all day event from "Nov 1" to "Nov 1" lasts the entire day. 876 + if ($this->getIsAllDay()) { 877 + $datetime = $datetime 878 + ->newAbsoluteDateTime() 879 + ->setHour(0) 880 + ->setMinute(0) 881 + ->setSecond(0) 882 + ->newRelativeDateTime('P1D') 883 + ->newAbsoluteDateTime(); 884 + } 885 + 886 + return $datetime; 868 887 } 869 888 870 889 public function getEndDateTimeEpoch() {
+1 -1
src/applications/calendar/xaction/PhabricatorCalendarEventEndDateTransaction.php
··· 7 7 8 8 public function generateOldValue($object) { 9 9 // TODO: Upgrade this. 10 - return $object->getEndDateTimeEpoch(); 10 + return $object->newEndDateTimeForEdit()->getEpoch(); 11 11 } 12 12 13 13 public function applyInternalEffects($object, $value) {