mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-30 16:38:21 +01:00
Multi-day events should be correctly calculated for new js layout
Summary: Fixes T8304, Multi-day events should be correctly calculated for new js layout Test Plan: A day with events starting before midnight of the displayed day should be correctly placed and fitted for day view. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Maniphest Tasks: T8304 Differential Revision: https://secure.phabricator.com/D13008
This commit is contained in:
parent
ea131bb2ef
commit
e4c9914697
2 changed files with 16 additions and 2 deletions
|
@ -72,4 +72,10 @@ final class PhabricatorTime {
|
||||||
return $today;
|
return $today;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getDateTimeFromEpoch($epoch, PhabricatorUser $viewer) {
|
||||||
|
$datetime = new DateTime('@'.$epoch);
|
||||||
|
$datetime->setTimeZone($viewer->getTimeZone());
|
||||||
|
return $datetime;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,8 +103,16 @@ final class PHUICalendarDayView extends AphrontView {
|
||||||
$event->getEpochEnd() > $day_start_epoch) {
|
$event->getEpochEnd() > $day_start_epoch) {
|
||||||
|
|
||||||
if ($first_event_hour === null) {
|
if ($first_event_hour === null) {
|
||||||
$first_event_hour = new DateTime('@'.$event->getEpochStart());
|
$first_event_hour = PhabricatorTime::getDateTimeFromEpoch(
|
||||||
$first_event_hour->setTimeZone($viewer->getTimeZone());
|
$event->getEpochStart(),
|
||||||
|
$viewer);
|
||||||
|
|
||||||
|
$midnight = $this->getDateTime()->setTime(0, 0, 0);
|
||||||
|
|
||||||
|
if ($first_event_hour->format('U') < $midnight->format('U')) {
|
||||||
|
$first_event_hour = clone $midnight;
|
||||||
|
}
|
||||||
|
|
||||||
$eight_am = $this->getDateTime()->setTime(8, 0, 0);
|
$eight_am = $this->getDateTime()->setTime(8, 0, 0);
|
||||||
if ($eight_am->format('U') < $first_event_hour->format('U')) {
|
if ($eight_am->format('U') < $first_event_hour->format('U')) {
|
||||||
$first_event_hour = clone $eight_am;
|
$first_event_hour = clone $eight_am;
|
||||||
|
|
Loading…
Add table
Reference in a new issue