Skip to content

Commit

Permalink
Fix potential off-by-one error on line chart dates
Browse files Browse the repository at this point in the history
Picking a moment in time in the middle of the daily time range
is much safer than relying on the beginning or end to actually
fall on the date in question.
  • Loading branch information
zackgalbreath committed Dec 3, 2014
1 parent caab0e8 commit 48ed22e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions overview.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@
$chart_beginning_UTCDate = gmdate(FMT_DATETIME, $chart_beginning_timestamp);
$chart_end_UTCDate = gmdate(FMT_DATETIME, $chart_end_timestamp);
// to be passed on to javascript chart renderers
$chart_data_date = gmdate("M d Y H:i:s", $chart_end_timestamp);
$chart_data_date = gmdate("M d Y H:i:s", ($chart_end_timestamp + $chart_beginning_timestamp) / 2.0);

$data = gather_overview_data($chart_beginning_UTCDate, $chart_end_UTCDate,
$build_group["id"]);
Expand Down Expand Up @@ -333,7 +333,7 @@
$chart_beginning_UTCDate = gmdate(FMT_DATETIME, $chart_beginning_timestamp);
$chart_end_UTCDate = gmdate(FMT_DATETIME, $chart_end_timestamp);
// to be passed on to javascript chart renderers
$chart_data_date = gmdate("M d Y H:i:s", $chart_end_timestamp);
$chart_data_date = gmdate("M d Y H:i:s", ($chart_end_timestamp + $chart_beginning_timestamp) / 2.0);

$data = gather_static_data($chart_beginning_UTCDate, $chart_end_UTCDate,
$static_group["id"]);
Expand Down

0 comments on commit 48ed22e

Please sign in to comment.