working with dates in react
How can i subtract 7 days from current date?
Date.setDate is part of the spec for the default Date object https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/setDatesetDate(lastWeekDate.getDate() - 7) doesn't work, then it's a bug in the engine, not your code Array.filter to get only the ones you want. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filterisWithinInterval https://date-fns.org/v2.29.3/docs/isWithinInterval to determine if the issue's creation date is within the week you're looking at, and the subDays function Leon linked to create the two reference points. Something like: