1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 01:08:50 +02:00

Month view header should display month name of the month completely shown, not leading or trailing month.

Summary: Fixes T8229, Month view header should display month name of the month completely shown, not leading or trailing month.

Test Plan: Open month view for May. Month view header should be May, not April.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T8229

Differential Revision: https://secure.phabricator.com/D12887
This commit is contained in:
lkassianik 2015-05-17 16:37:21 -07:00
parent 427cc22149
commit a527d6c340

View file

@ -62,8 +62,6 @@ final class PHUICalendarMonthView extends AphrontView {
require_celerity_resource('phui-calendar-month-css');
$first = reset($days);
foreach ($days as $day) {
$day_number = $day->format('j');
@ -144,7 +142,7 @@ final class PHUICalendarMonthView extends AphrontView {
$warnings = $this->getQueryRangeWarning();
$box = id(new PHUIObjectBoxView())
->setHeader($this->renderCalendarHeader($first))
->setHeader($this->renderCalendarHeader($this->getDateTime()))
->appendChild($table)
->setFormErrors($warnings);
if ($this->error) {
@ -469,6 +467,7 @@ final class PHUICalendarMonthView extends AphrontView {
$year = $this->year;
list($next_year, $next_month) = $this->getNextYearAndMonth();
$end_date = new DateTime("{$next_year}-{$next_month}-01", $timezone);
list($start_of_week, $end_of_week) = $this->getWeekStartAndEnd();
@ -481,12 +480,14 @@ final class PHUICalendarMonthView extends AphrontView {
$first_weekday_of_month = $first_month_day_date->format('w');
$last_weekday_of_month = $last_month_day_date->format('w');
$day_date = id(clone $first_month_day_date);
$num_days_display = $days_in_month;
if ($start_of_week !== $first_weekday_of_month) {
$interim_start_num = ($first_weekday_of_month + 7 - $start_of_week) % 7;
$num_days_display += $interim_start_num;
$day_date = id(clone $first_month_day_date)
->modify('-'.$interim_start_num.' days');
$day_date->modify('-'.$interim_start_num.' days');
}
if ($end_of_week !== $last_weekday_of_month) {
$interim_end_day_num = ($end_of_week - $last_weekday_of_month + 7) % 7;