@@ -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
);
0 commit comments