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:
The date object, when casted, is in milliseconds. so:
dateFrom = moment(Date.now() - 7 * 24 * 3600 * 1000).format('YYYY-MM-DD');