var d = new Date(); d.setDate(d.getDate()-1);
var date = new Date(); date.setDate( date.getDate() - 6 ); //current date - 6 days date.setFullYear( date.getFullYear() - 1 ); // current date - 1 year
use moment.js