1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

Probably fix some display issues with all-day events?

Summary:
Ref T11801. These are pretty fiddly because users expect to see the end time for timed events ("10 AM - 11 AM" is ONE hour long) but not for all-day events ("Nov 2 - Nov 3" is TWO days long!)

We also want to store the thing the user actually entered so we don't lose data if they un-all-day the event later.

This may take a little more fiddling since it feels a little shaky, but I couldn't break this version immediately.

Test Plan: Imported a French holiday, got proper display in the UI.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11801

Differential Revision: https://secure.phabricator.com/D16815
This commit is contained in:
epriestley 2016-11-07 10:38:42 -08:00
parent 7ddd570fa5
commit 87c4efdb63
2 changed files with 12 additions and 2 deletions

View file

@ -593,6 +593,9 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO
$min_date = $start->newPHPDateTime();
$max_date = $end->newPHPDateTime();
// Subtract one second since the stored date is exclusive.
$max_date = $max_date->modify('-1 second');
$min_day = $min_date->format('Y m d');
$max_day = $max_date->format('Y m d');
@ -849,7 +852,11 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO
// If this is an all day event, we move the end date time forward to the
// first second of the following day. This is consistent with what users
// expect: an all day event from "Nov 1" to "Nov 1" lasts the entire day.
if ($this->getIsAllDay()) {
// For imported events, the end date is already stored with this
// adjustment.
if ($this->getIsAllDay() && !$this->isImportedEvent()) {
$datetime = $datetime
->newAbsoluteDateTime()
->setHour(0)

View file

@ -198,8 +198,11 @@ final class PHUICalendarListView extends AphrontTagView {
$viewer,
$event->getEpochEnd()));
$end_date = $end->getDateTime();
$end_date = $end_date->modify('-1 second');
$start_date = $start->getDateTime()->format('m d Y');
$end_date = $end->getDateTime()->format('m d Y');
$end_date = $end_date->format('m d Y');
if ($event->getIsAllDay()) {
if ($start_date == $end_date) {