updateYear(shouldIncrement) {
    if (this.state.showStatsBy !== 'byMonth') {
      return;
    }

    // Make sure type of current and available years match
    const showStatsYear = parseInt(this.state.showStatsYear, 10);
    const availableYears = this.props.locations[this.props.currentLocation]
      .availableYears
      .map((yr) => Number.parseInt(yr, 10));

    const showIdx = availableYears.indexOf(showStatsYear);

    const firstYear = [...availableYears].shift();
    const lastYear = [...availableYears].pop();

    if (shouldIncrement && showStatsYear !== lastYear) {
      this.setState({ showStatsYear: availableYears[showIdx + 1] });
    } else if (!shouldIncrement && showStatsYear !== firstYear) {
      this.setState({ showStatsYear: availableYears[showIdx - 1] });
    }
  }
/**
   * Increment or decrement current state year
   *
   * @param {Bool} shouldIncrement `true` to increment, `false` to decrement
   */
Increment or decrement current state year
@param {Bool} shouldIncrement `true` to increment, `false` to decrement
Increment or decrement current state year @param { Bool } shouldIncrement ` true ` to increment ` false ` to decrement
updateYear(shouldIncrement) {
    if (this.state.showStatsBy !== 'byMonth') {
      return;
    }
    const showStatsYear = parseInt(this.state.showStatsYear, 10);
    const availableYears = this.props.locations[this.props.currentLocation]
      .availableYears
      .map((yr) => Number.parseInt(yr, 10));
    const showIdx = availableYears.indexOf(showStatsYear);
    const firstYear = [...availableYears].shift();
    const lastYear = [...availableYears].pop();
    if (shouldIncrement && showStatsYear !== lastYear) {
      this.setState({ showStatsYear: availableYears[showIdx + 1] });
    } else if (!shouldIncrement && showStatsYear !== firstYear) {
      this.setState({ showStatsYear: availableYears[showIdx - 1] });
    }
  }
updateYear ( shouldIncrement ) { if ( this . state . showStatsBy !== 'byMonth' ) { return ; } const showStatsYear = parseInt ( this . state . showStatsYear , 10 ) ; const availableYears = this . props . locations [ this . props . currentLocation ] . availableYears . map ( ( yr ) => Number . parseInt ( yr , 10 ) ) ; const showIdx = availableYears . indexOf ( showStatsYear ) ; const firstYear = [ ... availableYears ] . shift ( ) ; const lastYear = [ ... availableYears ] . pop ( ) ; if ( shouldIncrement && showStatsYear !== lastYear ) { this . setState ( { showStatsYear : availableYears [ showIdx + 1 ] } ) ; } else if ( ! shouldIncrement && showStatsYear !== firstYear ) { this . setState ( { showStatsYear : availableYears [ showIdx - 1 ] } ) ; } }
Increment or decrement current state year
 @param {Bool} shouldIncrement `true` to increment, `false` to decrement
Increment or decrement current state year @param { Bool } shouldIncrement ` true ` to increment ` false ` to decrement
// Make sure type of current and available years match