Need help on solving this, should be a small task, but could not figured it out.
Problem: data is an array of objects with the first date of the week in x and a value for that week in y. need a solution/function that will return all dates in that week in x and the same value in y for each date in that particular week. I'm using moment.js in case needed.
Input:
data = 
    [
        {
            "x": "2022-07-25",
            "y": 0.5
        },
        {
            "x": "2022-08-01",
            "y": 0.2
        },
        {
            "x": "2022-08-08",
            "y": 0.3
        }
    ]
Expected output:
data = 
    [
        {
            "x": "2022-07-25",
            "y": 0.5
        },
    {
            "x": "2022-07-26",
            "y": 0.5
        },
    {
            "x": "2022-07-27",
            "y": 0.5
        },
    {
            "x": "2022-07-28",
            "y": 0.5
        },
    {
            "x": "2022-07-29",
            "y": 0.5
        },
    {
            "x": "2022-07-30",
            "y": 0.5
        },
    {
            "x": "2022-07-31",
            "y": 0.5
        },
        {
            "x": "2022-08-01",
            "y": 0.2
        },
    {
            "x": "2022-08-02",
            "y": 0.2
        },
    {
            "x": "2022-08-03",
            "y": 0.2
        },
    {
            "x": "2022-08-04",
            "y": 0.2
        },
    {
            "x": "2022-08-05",
            "y": 0.2
        },
    {
            "x": "2022-08-06",
            "y": 0.2
        },
    {
            "x": "2022-08-07",
            "y": 0.2
        },
        {
            "x": "2022-08-08",
            "y": 0.3
        },{
            "x": "2022-08-09",
            "y": 0.3
        }
    ,{
            "x": "2022-08-10",
            "y": 0.3
        }
    ,{
            "x": "2022-08-11",
            "y": 0.3
        },{
            "x": "2022-08-12",
            "y": 0.3
        },{
            "x": "2022-08-13",
            "y": 0.3
        },{
            "x": "2022-08-14",
            "y": 0.3
        }
    ]
 
     
     
    