@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 default start value of new events to be the next whole hour and the end value to be the next whole hour after that.

Summary: Ref T8031, Make default start value of new events to be the next whole hour and the end value to be the next whole hour after that.

Test Plan: Create new event at, say, 10:30am. Event default times should be 11:00 AM - 12:00 PM

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T8031

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

+20 -2
+20 -2
src/applications/calendar/controller/PhabricatorCalendarEventEditController.php
··· 23 23 24 24 if ($this->isCreate()) { 25 25 $event = PhabricatorCalendarEvent::initializeNewCalendarEvent($user); 26 - $end_value = AphrontFormDateControlValue::newFromEpoch($user, time()); 27 - $start_value = AphrontFormDateControlValue::newFromEpoch($user, time()); 26 + list($start_value, $end_value) = $this->getDefaultTimeValues($user); 27 + 28 28 $submit_label = pht('Create'); 29 29 $page_title = pht('Create Event'); 30 30 $redirect = 'created'; ··· 347 347 } 348 348 349 349 return $new; 350 + } 351 + 352 + private function getDefaultTimeValues($user) { 353 + $start = new DateTime('@'.time()); 354 + $start->setTimeZone($user->getTimeZone()); 355 + 356 + $start->setTime($start->format('H'), 0, 0); 357 + $start->modify('+1 hour'); 358 + $end = id(clone $start)->modify('+1 hour'); 359 + 360 + $start_value = AphrontFormDateControlValue::newFromEpoch( 361 + $user, 362 + $start->format('U')); 363 + $end_value = AphrontFormDateControlValue::newFromEpoch( 364 + $user, 365 + $end->format('U')); 366 + 367 + return array($start_value, $end_value); 350 368 } 351 369 352 370 }