@@ -74,15 +74,20 @@ function getGraphRange(
7474 // ranges. If the commit range is not larger than the `dayRange`, the display will likely be
7575 // "centered" around the commit date.
7676
77- // Calculate the end of the range, which is commit date + half of the
78- // amount of days we want to show. If this date is in the future,
79- // the server will clip the result at the current date.
80- const end = formatDate (getFutureDate (end_date , DAY_RANGE / 2 ));
77+ // Calculate the end of the range, which is the earlier date between
78+ // current date and the commit date + half of the amount of days we
79+ // want to show.
80+ let centered_end = getFutureDate (end_date , DAY_RANGE / 2 );
81+ const today = new Date ().setUTCHours (0 , 0 , 0 , 0 );
82+ if (centered_end .getTime () > today ) {
83+ centered_end = new Date (today );
84+ }
85+ const end = formatDate (centered_end );
8186
8287 // Calculate the start of the range, which is the earlier date between
83- // the base artifact date and the commit date - half of the amount of days
88+ // the base artifact date and the calculated end date - the amount of days
8489 // we want to show.
85- const centered_start = getPastDate (end_date , DAY_RANGE / 2 );
90+ const centered_start = getPastDate (centered_end , DAY_RANGE );
8691 const start = formatDate (
8792 start_date < centered_start ? start_date : centered_start
8893 );
@@ -253,7 +258,7 @@ function graphLink(
253258 testCase : CompileTestCase
254259): string {
255260 // Move to `30 days ago` to display history of the test case
256- const start = getPastDate (new Date (commit .date ), 30 );
261+ const start = formatDate ( getPastDate (new Date (commit .date ), 30 ) );
257262 const end = commit .commit ;
258263 const {benchmark, profile, scenario} = testCase ;
259264 return ` /index.html?start=${start }&end=${end }&benchmark=${benchmark }&profile=${profile }&scenario=${scenario }&stat=${metric } ` ;
0 commit comments