diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 2ec25da2d..0ef0d1eb8 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -255,6 +255,7 @@ Ranjit Odedra Eltaurus jariji Francisco Esteva +Junia Mannervik ******************** diff --git a/ts/lib/tslib/time.ts b/ts/lib/tslib/time.ts index 25d70eef3..0e6330f38 100644 --- a/ts/lib/tslib/time.ts +++ b/ts/lib/tslib/time.ts @@ -178,9 +178,11 @@ export function dayLabel(daysStart: number, daysEnd: number): string { daysEnd: daysEnd - 1, }); } else { + const mostRecent = daysEnd <= 0 ? Math.abs(daysEnd - 1) : 0; + const oldest = -daysStart; return tr.statisticsDaysAgoRange({ - daysStart: Math.abs(daysEnd - 1), - daysEnd: -daysStart, + daysStart: mostRecent, + daysEnd: oldest, }); } } diff --git a/ts/routes/graphs/calendar.ts b/ts/routes/graphs/calendar.ts index 863923095..14c32d089 100644 --- a/ts/routes/graphs/calendar.ts +++ b/ts/routes/graphs/calendar.ts @@ -118,6 +118,10 @@ export function renderCalendar( // don't fill out future dates continue; } + if (date.getFullYear() != targetYear) { + // only fill blanks for the target year + continue; + } if (revlogRange == RevlogRange.Year && date < oneYearAgoFromNow) { // don't fill out dates older than a year continue;