I would like to subtract 7 days from current date to get formatted date YYYY-MM-DD using moment.js library.
I tried to do by this way:
Easiest method to get last 7th day
moment().subtract(7, 'days').startOf('day').format('YYYY-MM-DD HH:mm:ss')