fix(heat-map): Show last 8 months of activity (#18004)

pull/17419/head
lkozyr 2018-08-29 19:33:46 +03:00 committed by mrugesh mohapatra
parent b5014b85b7
commit f0e5633b98
1 changed files with 5 additions and 1 deletions

View File

@ -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