'How to split daily data into groups of 7 for recharts data? Using JSON and react

I have an array of objects that are daily and I want to split them into weeks. I have it working with each object feeding in and creating separate daily data points. But I want to combine say a weeks worth or 7 objects and sum or do some mathematical operation on their values and have that outpoint as a single data point.

Will I need to do the manipulation before feeding in the data or is that something recharts can do for me?

Example of one of the daily objects

    {
        "playerId": 547180,
        "fullName": "Bryce Harper",
        "gameDate": "2018-03-30 16:10:00",
        "team": "WSH",
        "opponent": "CIN",
        "PA": 4,
        "AB": 3,
        "H": 2,
        "HR": 0,
        "BB": 1,
        "K": 0,
        "HBP": 0,
        "SF": 0,
        "TB": 2,
        "RBI": 0
    },


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source