I have an array of timestamps and values where I'm converting each timestamp to a date. I have some function where it shows the date from oldest to newest. I want to calculate last week, last month and last year based on today's date.
const myData = [
{timestamp: 1382086394000, value: 200},
{timestamp: 1382086394001, value: 200},
{timestamp: 1232131231232, value: 300},
{timestamp: 2131231241212, value: 400},
{timestamp: 1234124124112, value: 285},
{timestamp: 1251251251251, value: 123},
{timestamp: 1241241241241, value: 512},
{timestamp: 1241241241241, value: 124},
{timestamp: 2312312123121, value: 600},
];
This is the array looks like, keep in mind that I already have converted timestamp to an acutal date.