mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42:41 +01:00
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
This commit is contained in:
parent
6b1d13bfaf
commit
bb0004fd41
1 changed files with 20 additions and 2 deletions
|
@ -23,8 +23,8 @@ final class PhabricatorCalendarEventEditController
|
|||
|
||||
if ($this->isCreate()) {
|
||||
$event = PhabricatorCalendarEvent::initializeNewCalendarEvent($user);
|
||||
$end_value = AphrontFormDateControlValue::newFromEpoch($user, time());
|
||||
$start_value = AphrontFormDateControlValue::newFromEpoch($user, time());
|
||||
list($start_value, $end_value) = $this->getDefaultTimeValues($user);
|
||||
|
||||
$submit_label = pht('Create');
|
||||
$page_title = pht('Create Event');
|
||||
$redirect = 'created';
|
||||
|
@ -349,4 +349,22 @@ final class PhabricatorCalendarEventEditController
|
|||
return $new;
|
||||
}
|
||||
|
||||
private function getDefaultTimeValues($user) {
|
||||
$start = new DateTime('@'.time());
|
||||
$start->setTimeZone($user->getTimeZone());
|
||||
|
||||
$start->setTime($start->format('H'), 0, 0);
|
||||
$start->modify('+1 hour');
|
||||
$end = id(clone $start)->modify('+1 hour');
|
||||
|
||||
$start_value = AphrontFormDateControlValue::newFromEpoch(
|
||||
$user,
|
||||
$start->format('U'));
|
||||
$end_value = AphrontFormDateControlValue::newFromEpoch(
|
||||
$user,
|
||||
$end->format('U'));
|
||||
|
||||
return array($start_value, $end_value);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue