I need assistance with fetching and organizing data from the provided array of objects. I want to create two separate arrays based on the following criteria:
The first array should only include objects with a date in the current month.
The second array should contain objects from the past 7 days.
Any advice on working with dates would be greatly appreciated as it's not my strong suit.
{
"status": "success",
"results": 10,
"orders": [
{
"orderID": 1,
"orderStatus": 1,
"purAmt": 1000,
"orderDate": "2020-06-14T03:23:20.000Z",
"fullName": "velocity",
"email": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="255340494a464c515c654248444c490b464a48">[email protected]</a>",
"phone": "999999",
"flatNo": "b-863",
"complex": "tara tra",
"landmark": "kaskd",
"street": "asdasd",
"area": "rob city",
"city": "asda",
"products": [
{
"productID": 1,
"name": "lassi",
"price": 62,
"image": "images\\rtoRAOwj4-conn.PNG",
"quantity": 5
},
{
"productID": 2,
"name": "curd",
"price": 55,
"image": "curd.png",
"quantity": 9
}
]
},
// Multiple order objects follow...
]
}