@@ -74,15 +74,20 @@ function getGraphRange(
74
74
// ranges. If the commit range is not larger than the `dayRange`, the display will likely be
75
75
// "centered" around the commit date.
76
76
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 );
81
86
82
87
// 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
84
89
// we want to show.
85
- const centered_start = getPastDate (end_date , DAY_RANGE / 2 );
90
+ const centered_start = getPastDate (centered_end , DAY_RANGE );
86
91
const start = formatDate (
87
92
start_date < centered_start ? start_date : centered_start
88
93
);
@@ -253,7 +258,7 @@ function graphLink(
253
258
testCase : CompileTestCase
254
259
): string {
255
260
// 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 ) );
257
262
const end = commit .commit ;
258
263
const {benchmark, profile, scenario} = testCase ;
259
264
return ` /index.html?start=${start }&end=${end }&benchmark=${benchmark }&profile=${profile }&scenario=${scenario }&stat=${metric } ` ;
0 commit comments