From f0e5633b986c79c18e82eface8ad36815d19d94c Mon Sep 17 00:00:00 2001 From: lkozyr Date: Wed, 29 Aug 2018 19:33:46 +0300 Subject: [PATCH] fix(heat-map): Show last 8 months of activity (#18004) --- common/app/routes/Profile/components/HeatMap.jsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common/app/routes/Profile/components/HeatMap.jsx b/common/app/routes/Profile/components/HeatMap.jsx index 5991afadae..4629748b08 100644 --- a/common/app/routes/Profile/components/HeatMap.jsx +++ b/common/app/routes/Profile/components/HeatMap.jsx @@ -57,7 +57,11 @@ class HeatMap extends Component { const rectSelector = '#cal-heatmap > svg > svg.graph-legend > g > rect.r'; const calLegendTitles = ['0 items', '1 item', '2 items', '3 or more items']; const firstTS = Object.keys(calendar)[0]; - let start = new Date(firstTS * 1000); + const sevenMonths = 1000 * 60 * 60 * 24 * 210; + // start should not be earlier than 7 months before now: + let start = (firstTS * 1000 + sevenMonths < Date.now()) + ? new Date(Date.now() - sevenMonths) + : new Date(firstTS * 1000); const monthsSinceFirstActive = differenceInCalendarMonths( today, start