let now = new Date();
const backdate = new Date(now.setDate(now.getDate() - 30));
// If you are really fan of JavaScript then check it out
https://github.com/Asabeneh/30-Days-Of-JavaScript
https://github.com/wesbos/JavaScript30
[also look at the website]
https://javascript30.com/
// You will also love it
https://github.com/Asabeneh/30-Days-Of-React
var date = new Date();
date.setDate(date.getDate() - 30);
var dateString = date.toISOString().split('T')[0]; // "2016-06-08"
30 Day Vanilla JS Coding Challenge
Build 30 things in 30 days with 30 tutorials
No Frameworks×No Compilers×No Libraries×No Boilerplate