@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.

Conpherence - fix calendar bugs part deux

Summary: I needed to port my extremely clever "last sunday as of tomorrow" trick to the display layer. Also found a fun bug in testing where +N days was changing it to 1:00 AM from 00:00 AM with my timezone configuration. Presumably all sorts of whacky hyjinx ensue when you modify DateTime and you need to re-specify the timezone after to get it to work

Test Plan: verified that Today, SUNDAY, we see TODAY -> Saturday and it all looks good. Verified midnite -> just before midnight status events span but a single day.

Reviewers: epriestley, chad

Reviewed By: chad

CC: aran, Korvin

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

+12 -6
+10 -4
src/applications/conpherence/controller/ConpherenceWidgetController.php
··· 243 243 244 244 $week_day_number = $day->format('w'); 245 245 246 - $day->setTime(0, 0, 0); 247 246 $epoch_start = $day->format('U'); 248 247 $next_day = clone $day; 249 248 $next_day->modify('+1 day'); ··· 325 324 } 326 325 if ($is_today || ($calendar_columns && $calendar_columns < 3)) { 327 326 $active_class = ''; 328 - if ($day->format('Ymd') == $today->format('Ymd')) { 327 + if ($is_today) { 329 328 $active_class = '-active'; 330 329 } 331 330 $inner_layout = array(); ··· 383 382 $user = $this->getRequest()->getUser(); 384 383 $timezone = new DateTimeZone($user->getTimezoneIdentifier()); 385 384 386 - $first_day = new DateTime('last sunday', $timezone); 385 + $start_epoch = phabricator_format_local_time( 386 + strtotime('last sunday', strtotime('tomorrow')), 387 + $user, 388 + 'U'); 389 + $first_day = new DateTime('@'.$start_epoch, $timezone); 387 390 $timestamps = array(); 388 391 for ($day = 0; $day < 9; $day++) { 389 392 $timestamp = clone $first_day; 390 - $timestamps[] = $timestamp->modify(sprintf('+%d days', $day)); 393 + $timestamp->modify(sprintf('+%d days', $day)); 394 + // set the timezone again 'cuz DateTime is weird 395 + $timestamp->setTimeZone($timezone); 396 + $timestamps[] = $timestamp; 391 397 } 392 398 return array( 393 399 'today' => new DateTime('today', $timezone),
+2 -2
src/applications/conpherence/query/ConpherenceThreadQuery.php
··· 218 218 219 219 // statuses of everyone currently in the conpherence 220 220 // we show sunday -> saturday in a list *AND* a window 221 - // of today -> +2 days. If its saturday we need 222 - // +2 days. 221 + // of today -> +2 days. Ergo, if its saturday we need 222 + // +2 days, for +9 days total. 223 223 $start_epoch = phabricator_format_local_time( 224 224 strtotime('last sunday', strtotime('tomorrow')), 225 225 $this->getViewer(),